From 45dd8b8615bb1d7a93e1733746581049a1f399e6 Mon Sep 17 00:00:00 2001 From: Gar Date: Wed, 23 Mar 2022 15:16:49 -0700 Subject: fix: move shellout logic into commands Each command now signals whether or not it is a shellout --- lib/utils/cmd-list.js | 14 -------------- lib/utils/exit-handler.js | 2 +- 2 files changed, 1 insertion(+), 15 deletions(-) (limited to 'lib/utils') diff --git a/lib/utils/cmd-list.js b/lib/utils/cmd-list.js index b3089a62c..1469ebdd6 100644 --- a/lib/utils/cmd-list.js +++ b/lib/utils/cmd-list.js @@ -139,24 +139,10 @@ const cmdList = [ const plumbing = ['birthday', 'help-search'] -// these commands just shell out to something else or handle the -// error themselves, so it's confusing and weird to write out -// our full error log banner when they exit non-zero -const shellouts = [ - 'exec', - 'run-script', - 'test', - 'start', - 'stop', - 'restart', - 'birthday', -] - module.exports = { aliases: Object.assign({}, shorthands, affordances), shorthands, affordances, cmdList, plumbing, - shellouts, } diff --git a/lib/utils/exit-handler.js b/lib/utils/exit-handler.js index f96d162ce..d8ae9994d 100644 --- a/lib/utils/exit-handler.js +++ b/lib/utils/exit-handler.js @@ -144,7 +144,7 @@ const exitHandler = err => { // will presumably print its own errors and exit with a proper status // code if there's a problem. If we got an error with a code=0, then... // something else went wrong along the way, so maybe an npm problem? - const isShellout = npm.shelloutCommands.includes(npm.command) + const isShellout = npm.commandInstance && npm.commandInstance.constructor.isShellout const quietShellout = isShellout && typeof err.code === 'number' && err.code if (quietShellout) { exitCode = err.code -- cgit v1.2.3