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-25 03:33:18 +0400
committerisaacs <i@izs.me>2010-08-25 16:21:51 +0400
commitec1bee0889f6f2a956fbd6f31a6fadc606a5393d (patch)
tree389f0da5ac38623351de9d3a98c8f23c06f95e63
parent3781a298baf83ed3f2550c2afc09885738780595 (diff)
Don't buffer logs unless we know that the config is coming.
An inelegant solution, but it works.
-rwxr-xr-xcli.js2
-rw-r--r--lib/utils/log.js4
2 files changed, 4 insertions, 2 deletions
diff --git a/cli.js b/cli.js
index 1fcca7417..794af4309 100755
--- a/cli.js
+++ b/cli.js
@@ -3,7 +3,7 @@
// don't assume that npm is installed in any particular spot, since this
// might conceivably be a bootstrap attempt.
var log = require("./lib/utils/log")
-
+log.waitForConfig()
log.info("ok", "it worked if it ends with")
var fs = require("./lib/utils/graceful-fs")
diff --git a/lib/utils/log.js b/lib/utils/log.js
index 02fafadba..15cdd37c2 100644
--- a/lib/utils/log.js
+++ b/lib/utils/log.js
@@ -62,6 +62,8 @@ COLOR.pref = 35
var logBuffer = []
, ini = require("./ini")
+ , waitForConfig
+log.waitForConfig = function () { waitForConfig = true }
function log (msg, pref, level, cb) {
if (typeof level === "function") cb = level, level = null
@@ -93,7 +95,7 @@ function log (msg, pref, level, cb) {
msg = msg.stack || msg.toString()
level = LEVEL.error
}
- if (!ini.resolved) {
+ if (!ini.resolved && waitForConfig) {
return logBuffer.push([msg, pref, level])
}
if (logBuffer.length && !logBuffer.discharging) {