Skip to content

Commit dce3b08

Browse files
authoredNov 6, 2023
fix: properly catch missing url opener error (#6951)
1 parent e91d5c6 commit dce3b08

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed
 

‎lib/utils/open-url.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const open = async (npm, url, errMsg, isFile) => {
3939
const command = browser === true ? null : browser
4040
await promiseSpawn.open(url, { command })
4141
.catch((err) => {
42-
if (err.code !== 'ENOENT') {
42+
if (err.code !== 127) {
4343
throw err
4444
}
4545

‎test/lib/utils/open-url.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ t.test('prints where to go when given browser does not exist', async t => {
124124
const { openerUrl, openerOpts, joinedOutput } = await mockOpenUrl(t,
125125
['https://www.npmjs.com', 'npm home'],
126126
{
127-
openerResult: Object.assign(new Error('failed'), { code: 'ENOENT' }),
127+
openerResult: Object.assign(new Error('failed'), { code: 127 }),
128128
}
129129
)
130130

0 commit comments

Comments
 (0)
Please sign in to comment.