diff options
author | indexzero <charlie.robbins@gmail.com> | 2011-01-19 09:18:09 +0300 |
---|---|---|
committer | isaacs <i@izs.me> | 2011-01-19 21:33:46 +0300 |
commit | 5df88c440455cffca5999f032b47a852e290d7a9 (patch) | |
tree | a90b7075eafea8e8fed462a0929dee76360082a5 /npm.js | |
parent | da173e299ead684c4b07bf260f282da2d36a1583 (diff) |
[fix] Prevent infinite loops in npm.load() when multiple callbacks call npm.load()
Diffstat (limited to 'npm.js')
-rw-r--r-- | npm.js | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -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) { |