diff options
-rw-r--r-- | lib/deactivate.js | 7 | ||||
-rw-r--r-- | lib/uninstall.js | 7 | ||||
-rw-r--r-- | lib/utils/lifecycle.js | 2 |
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) |