From a964fe1a3bf3fb617c396fe508c531f6dfcc628f Mon Sep 17 00:00:00 2001 From: isaacs Date: Thu, 26 Jun 2014 14:17:48 -0700 Subject: Consolidate color sniffing in config/log loading process --- lib/npm.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/npm.js b/lib/npm.js index 34df1c233..c7288e2b7 100644 --- a/lib/npm.js +++ b/lib/npm.js @@ -336,20 +336,14 @@ function load (npm, cli, cb) { log.level = config.get("loglevel") log.heading = config.get("heading") || "npm" log.stream = config.get("logstream") - switch (color) { - case "always": log.enableColor(); break - case false: log.disableColor(); break - } - log.resume() - if (er) return cb(er) - - // see if we need to color normal output switch (color) { case "always": + log.enableColor() npm.color = true break case false: + log.disableColor() npm.color = false break default: @@ -361,6 +355,8 @@ function load (npm, cli, cb) { break } + log.resume() + // at this point the configs are all set. // go ahead and spin up the registry client. npm.registry = new RegClient(npm.config) @@ -376,7 +372,7 @@ function load (npm, cli, cb) { var lp = Object.getOwnPropertyDescriptor(config, "localPrefix") Object.defineProperty(npm, "localPrefix", lp) - return cb() + return cb(null, npm) }) }) } -- cgit v1.2.3