Skip to content

Commit

Permalink
fix: properly catch missing url opener error (#6951)
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar authored Nov 6, 2023
1 parent e91d5c6 commit dce3b08
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/utils/open-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const open = async (npm, url, errMsg, isFile) => {
const command = browser === true ? null : browser
await promiseSpawn.open(url, { command })
.catch((err) => {
if (err.code !== 'ENOENT') {
if (err.code !== 127) {
throw err
}

Expand Down
2 changes: 1 addition & 1 deletion test/lib/utils/open-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ t.test('prints where to go when given browser does not exist', async t => {
const { openerUrl, openerOpts, joinedOutput } = await mockOpenUrl(t,
['https://www.npmjs.com', 'npm home'],
{
openerResult: Object.assign(new Error('failed'), { code: 'ENOENT' }),
openerResult: Object.assign(new Error('failed'), { code: 127 }),
}
)

Expand Down

0 comments on commit dce3b08

Please sign in to comment.