From c50a3986d4fb7d0715740242d2f14d4aceacac6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kat=20March=C3=A1n?= Date: Fri, 9 Jun 2017 23:46:55 -0700 Subject: [PATCH] fix(exit): let process exit normally to finish writes --- index.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index 00c00f1..8cc0c56 100755 --- a/index.js +++ b/index.js @@ -26,17 +26,18 @@ function main (argv) { shell, process.env.SHELL, argv ) if (fallback) { - console.log(fallback) - process.exit(0) + return console.log(fallback) } else { - process.exit(1) + process.exitCode = 1 + return } } if (!argv.command || !argv.package) { - console.error('\nERROR: You must supply a command.\n') + console.error(Y`\nERROR: You must supply a command.\n`) parseArgs.showHelp() - process.exit(1) + process.exitCode = 1 + return } return localBinPath(process.cwd()).then(local => { @@ -52,7 +53,7 @@ function main (argv) { } ).catch(err => { console.error(err.message) - process.exit(err.exitCode || 1) + process.exitCode = err.exitCode || 1 }) }) }