diff options
author | Rebecca Turner <me@re-becca.org> | 2015-06-17 05:27:22 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2015-06-26 03:27:19 +0300 |
commit | b89d8d1507ac13ad0031aae2c14b864484dd5fa4 (patch) | |
tree | 8993c2e1aebd24ea91cf6e1aadef6de9cd073d69 /lib/install | |
parent | aa00b187241b3948501004ccc0941d7eb60d9526 (diff) |
bug: Fix #8138 stack-overflow when idealizing large trees
What was going on here is that we were shortcircuiting when
there weren't any children... and these calls ended up essentially
chaining together one after another till the call stack limit
as hit. Insisting that this function be async w/ dezalgo allows
the short cirtuiting to not blow the stack.
Diffstat (limited to 'lib/install')
-rw-r--r-- | lib/install/deps.js | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/install/deps.js b/lib/install/deps.js index abcf7bc70..d84a0b244 100644 --- a/lib/install/deps.js +++ b/lib/install/deps.js @@ -10,6 +10,7 @@ var iferr = require('iferr') var npa = require('npm-package-arg') var validate = require('aproba') var realizePackageSpecifier = require('realize-package-specifier') +var dezalgo = require('dezalgo') var fetchPackageMetadata = require('../fetch-package-metadata.js') var andAddParentToErrors = require('./and-add-parent-to-errors.js') var addShrinkwrap = require('../fetch-package-metadata.js').addShrinkwrap @@ -203,6 +204,7 @@ exports.removeDeps = function (args, tree, saveToDependencies, log, next) { function andForEachChild (load, next) { validate('F', [next]) + next = dezalgo(next) return function (er, children, logs) { // when children is empty, logs won't be passed in at all (asyncMap is weird) // so shortcircuit before arg validation |