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:
authorisaacs <i@izs.me>2010-08-27 11:24:19 +0400
committerisaacs <i@izs.me>2010-08-27 11:24:19 +0400
commite3486d65e72d1b09561a8fcb920331630716a5b5 (patch)
tree48adf8b85cd50ac806add65d87ca6c9bf9c75e65
parent83f68e44a0bbadafd58c6a3fdf294a877b708085 (diff)
Don't fail on uninstall/deactivate script failures.
-rw-r--r--lib/deactivate.js7
-rw-r--r--lib/uninstall.js7
-rw-r--r--lib/utils/lifecycle.js2
3 files changed, 14 insertions, 2 deletions
diff --git a/lib/deactivate.js b/lib/deactivate.js
index 8cf32faa6..11be43f04 100644
--- a/lib/deactivate.js
+++ b/lib/deactivate.js
@@ -14,13 +14,18 @@ var mkdir = require("./utils/mkdir-p")
module.exports = deactivate
function deactivate (args, cb) {
+ var rb = npm.ROLLBACK
+ npm.ROLLBACK = true
asyncMap(args.map(function (a) {
return a.split("@").shift()
}), preDeactivate, function (er, data) {
if (er) return cb(er)
asyncMap(data, deactivate_, 5, function (er) {
if (er) return cb(er)
- asyncMap(data, postDeactivate, cb)
+ asyncMap(data, postDeactivate, function (er) {
+ npm.ROLLBACK = rb
+ cb(er)
+ })
})
})
}
diff --git a/lib/uninstall.js b/lib/uninstall.js
index 61b3e3725..870d7bc9b 100644
--- a/lib/uninstall.js
+++ b/lib/uninstall.js
@@ -26,10 +26,15 @@ function uninstall (args, cb) {
unpackArgs(args, function (er, args) {
if (er) return cb(er)
if (!args || !args.length) return cb()
+ var rb = npm.ROLLBACK
+ npm.ROLLBACK = true
chain
( [firstPart, args]
, [secondPart, args]
- , cb
+ , function (er) {
+ npm.ROLLBACK = rb
+ cb(er)
+ }
)
})
}
diff --git a/lib/utils/lifecycle.js b/lib/utils/lifecycle.js
index 47a917d7e..66b94f699 100644
--- a/lib/utils/lifecycle.js
+++ b/lib/utils/lifecycle.js
@@ -39,6 +39,8 @@ function lifecycle (pkg, stage, cb) {
er.message = pkg._id + " " + stage + ": `" + env.npm_lifecycle_script+"`\n"
+ er.message
return cb(er)
+ } else if (er) {
+ log.error(er, pkg._id+"."+stage+" failed")
}
// check for a hook script
var hook = path.join(npm.dir, ".hooks", stage)