diff options
author | isaacs <i@izs.me> | 2010-07-05 09:03:15 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2010-07-25 05:51:17 +0400 |
commit | 01ec10f5afe155ba7a669e47d13c199daf0bc499 (patch) | |
tree | 99b1930bd0eb9818902360c51721df5c3c7ea45a | |
parent | 9fe57adffa4364ec5c260f66fa4605ccb127fd0d (diff) |
Manually exit if necessary, and say "not ok" when not ok
-rwxr-xr-x | cli.js | 25 |
1 files changed, 16 insertions, 9 deletions
@@ -51,6 +51,9 @@ if (printVersion) { } else log(npm.version, "version") process.on("uncaughtException", errorHandler) +process.on("exit", function () { if (!itWorked) log("not ok") }) + +var itWorked = false if (!command) { if (!printVersion) { // npm.commands.help([arglist.join(" ")]) @@ -65,14 +68,18 @@ if (!command) { if (!printVersion) { }} else npm.commands[command](arglist, errorHandler) function errorHandler (er) { - if (er) { - sys.error("") - log(er, "!") - sys.error("") - log("try running: 'npm help "+command+"'", "failure") - log("Report this *entire* log at <http://github.com/isaacs/npm/issues>", "failure") - log("or email it to <npm-@googlegroups.com>", "failure") - process.exit(1) - } else log("ok") + if (!er) { + itWorked = true + log("ok") + if (npm.SHOULD_EXIT) process.exit() + return + } + sys.error("") + log(er, "!") + sys.error("") + log("try running: 'npm help "+command+"'", "failure") + log("Report this *entire* log at <http://github.com/isaacs/npm/issues>", "failure") + log("or email it to <npm-@googlegroups.com>", "failure") + process.exit(1) } |