diff options
author | isaacs <i@izs.me> | 2012-06-10 21:29:47 -0700 |
---|---|---|
committer | isaacs <i@izs.me> | 2012-06-11 08:13:36 -0700 |
commit | 13198357e9973c6d29283ca7d69d57f5986b9474 (patch) | |
tree | 93de20789b309b2315b75e4a5577bd644335add5 /deps/npm/lib/utils/lifecycle.js | |
parent | 284816ee9ff67aaa997b803db4f1ebb207672c6d (diff) | |
download | node-new-13198357e9973c6d29283ca7d69d57f5986b9474.tar.gz |
Upgrade npm to 1.1.25
Diffstat (limited to 'deps/npm/lib/utils/lifecycle.js')
-rw-r--r-- | deps/npm/lib/utils/lifecycle.js | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/deps/npm/lib/utils/lifecycle.js b/deps/npm/lib/utils/lifecycle.js index c5ebbbee14..2f31af007f 100644 --- a/deps/npm/lib/utils/lifecycle.js +++ b/deps/npm/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,12 +156,12 @@ 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 - if (er.errno !== constants.EPERM) { - er.errno = npm.ELIFECYCLE + if (er.code !== "EPERM") { + er.code = "ELIFECYCLE" } er.pkgid = pkg._id er.stage = stage @@ -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) |