diff options
Diffstat (limited to 'deps/npm/lib/cache/add-local.js')
-rw-r--r-- | deps/npm/lib/cache/add-local.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/deps/npm/lib/cache/add-local.js b/deps/npm/lib/cache/add-local.js index 075ca5fc61..0794b92144 100644 --- a/deps/npm/lib/cache/add-local.js +++ b/deps/npm/lib/cache/add-local.js @@ -20,7 +20,7 @@ module.exports = addLocal function addLocal (p, pkgData, cb_) { assert(typeof p === 'object', 'must have spec info') - assert(typeof cb === 'function', 'must have callback') + assert(typeof cb_ === 'function', 'must have callback') pkgData = pkgData || {} @@ -91,10 +91,10 @@ function addLocalDirectory (p, pkgData, shasum, cb) { getCacheStat(function (er, cs) { mkdir(path.dirname(pj), function (er, made) { - if (er) return cb(er) + if (er) return wrapped(er) var doPrePublish = !pathIsInside(p, npm.tmp) if (doPrePublish) { - lifecycle(data, 'prepublish', p, iferr(cb, thenPack)) + lifecycle(data, 'prepublish', p, iferr(wrapped, thenPack)) } else { thenPack() } @@ -102,12 +102,15 @@ function addLocalDirectory (p, pkgData, shasum, cb) { tar.pack(tgz, p, data, function (er) { if (er) { log.error('addLocalDirectory', 'Could not pack', p, 'to', tgz) - return cb(er) + return wrapped(er) } - if (!cs || isNaN(cs.uid) || isNaN(cs.gid)) wrapped() + if (!cs || isNaN(cs.uid) || isNaN(cs.gid)) return wrapped() - chownr(made || tgz, cs.uid, cs.gid, wrapped) + chownr(made || tgz, cs.uid, cs.gid, function (er) { + if (er && er.code === 'ENOENT') return wrapped() + wrapped(er) + }) }) } }) |