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
path: root/npm.js
diff options
context:
space:
mode:
authorindexzero <charlie.robbins@gmail.com>2011-01-19 09:18:09 +0300
committerisaacs <i@izs.me>2011-01-19 21:33:46 +0300
commit5df88c440455cffca5999f032b47a852e290d7a9 (patch)
treea90b7075eafea8e8fed462a0929dee76360082a5 /npm.js
parentda173e299ead684c4b07bf260f282da2d36a1583 (diff)
[fix] Prevent infinite loops in npm.load() when multiple callbacks call npm.load()
Diffstat (limited to 'npm.js')
-rw-r--r--npm.js7
1 files changed, 3 insertions, 4 deletions
diff --git a/npm.js b/npm.js
index 3008f2884..c3e2c7b24 100644
--- a/npm.js
+++ b/npm.js
@@ -126,10 +126,9 @@ npm.load = function (conf, cb_) {
loading = true
function cb (er) {
loaded = true
- loadListeners.forEach(function (cb) {
- cb(er, npm)
- })
- loadListeners.length = 0
+ while (loadListeners.length > 0) {
+ loadListeners.shift()(er, npm)
+ }
}
log.waitForConfig()
which(process.argv[0], function (er, node) {