diff options
Diffstat (limited to 'lib/utils/lifecycle.js')
-rw-r--r-- | lib/utils/lifecycle.js | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/lib/utils/lifecycle.js b/lib/utils/lifecycle.js index c5ebbbee1..69935b9b1 100644 --- a/lib/utils/lifecycle.js +++ b/lib/utils/lifecycle.js @@ -2,7 +2,7 @@ exports = module.exports = lifecycle exports.cmd = cmd -var log = require("./log.js") +var log = require("npmlog") , exec = require("./exec.js") , npm = require("../npm.js") , path = require("path") @@ -31,7 +31,7 @@ function lifecycle (pkg, stage, wd, unsafe, failOk, cb) { while (pkg && pkg._data) pkg = pkg._data if (!pkg) return cb(new Error("Invalid package data")) - log(pkg._id, stage) + log.info(stage, pkg._id) if (!pkg.scripts) pkg.scripts = {} validWd(wd || path.resolve(npm.dir, pkg.name), function (er, wd) { @@ -41,7 +41,8 @@ function lifecycle (pkg, stage, wd, unsafe, failOk, cb) { if ((wd.indexOf(npm.dir) !== 0 || path.basename(wd) !== pkg.name) && !unsafe && pkg.scripts[stage]) { - log.warn(pkg._id+" "+pkg.scripts[stage], "skipping, cannot run in "+wd) + log.warn( "cannot run in wd", "%s %s (wd=%s)" + , pkg._id, pkg.scripts[stage], wd) return cb() } @@ -98,14 +99,14 @@ function lifecycle_ (pkg, stage, wd, env, unsafe, failOk, cb) { if (failOk) { cb = (function (cb_) { return function (er) { - if (er) log.warn(er.message, "continuing anyway") + if (er) log.warn("continuing anyway", er.message) cb_() }})(cb) } if (npm.config.get("force")) { cb = (function (cb_) { return function (er) { - if (er) log(er, "forced, continuing") + if (er) log.info("forced, continuing", er) cb_() }})(cb) } @@ -143,7 +144,7 @@ function runPackageLifecycle (pkg, env, wd, unsafe, cb) { shFlag = "/c" } - log.verbose(unsafe, "unsafe-perm in lifecycle") + log.verbose("unsafe-perm in lifecycle", unsafe) var note = "\n> " + pkg._id + " " + stage + " " + wd + "\n> " + cmd + "\n" @@ -155,7 +156,7 @@ function runPackageLifecycle (pkg, env, wd, unsafe, cb) { , user, group , function (er, code, stdout, stderr) { if (er && !npm.ROLLBACK) { - log("Failed to exec "+stage+" script", pkg._id) + log.info(pkg._id, "Failed to exec "+stage+" script") er.message = pkg._id + " " + stage + ": `" + env.npm_lifecycle_script+"`\n" + er.message @@ -168,8 +169,8 @@ function runPackageLifecycle (pkg, env, wd, unsafe, cb) { er.pkgname = pkg.name return cb(er) } else if (er) { - log.error(er, pkg._id+"."+stage) - log.error("failed, but continuing anyway", pkg._id+"."+stage) + log.error(pkg._id+"."+stage, er) + log.error(pkg._id+"."+stage, "continuing anyway") return cb() } cb(er) @@ -193,7 +194,7 @@ function runHookLifecycle (pkg, env, wd, unsafe, cb) { , function (er) { if (er) { er.message += "\nFailed to exec "+stage+" hook script" - log(er, pkg._id) + log.info(pkg._id, er) } if (npm.ROLLBACK) return cb() cb(er) @@ -260,10 +261,6 @@ function makeEnv (data, prefix, env) { return } var value = ini.get(i) - if (/^(log|out)fd$/.test(i) && typeof value === "object") { - // not an fd, a stream - return - } if (!value) value = "" else if (typeof value !== "string") value = JSON.stringify(value) |