Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcli.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/cli.js b/cli.js
index 944bce743..02a8f3071 100755
--- a/cli.js
+++ b/cli.js
@@ -94,11 +94,14 @@ if (!command && !conf.help) {
})
}
+var cbCalled = false
function errorHandler (er) {
+ if (cbCalled) throw new Error("Callback called more than once.")
+ cbCalled = true
if (!er) {
itWorked = true
log.win("ok")
- return exit(0)
+ return exit()
}
log.error(er)
if (!(er instanceof Error)) return exit(1)
@@ -120,5 +123,5 @@ function errorHandler (er) {
}
function exit (code) {
- rm(npm.tmp, function () { process.exit(code) })
+ rm(npm.tmp, function () { process.exit(code || 0) })
}