diff options
author | Rebecca Turner <me@re-becca.org> | 2017-05-16 03:25:05 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2017-05-26 04:55:21 +0300 |
commit | 3c3428277b2d045d9eabd6826125f6055d174ff7 (patch) | |
tree | 0775d7aeac32c75aec5e2ee74ab6a23a8509aba9 /lib | |
parent | ebbe7a0d005619d4ae3f54eb4b90ac4fac738abb (diff) |
git-prepare: Fix child process npm run
Previously it used the global npm, not the npm we were running from.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/config/pacote.js | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/config/pacote.js b/lib/config/pacote.js index a0a83d315..848a06cc7 100644 --- a/lib/config/pacote.js +++ b/lib/config/pacote.js @@ -134,7 +134,13 @@ function prepareAndPack (manifest, dir) { }) let errData = [] let errDataLen = 0 - child.stdout.on('data', () => log.gauge.pulse('preparing git package')) + let outData = [] + let outDataLen = 0 + child.stdout.on('data', (data) => { + outData.push(data) + outDataLen += data.length + log.gauge.pulse('preparing git package')) + }) child.stderr.on('data', (data) => { errData.push(data) errDataLen += data.length @@ -144,10 +150,6 @@ function prepareAndPack (manifest, dir) { child.on('error', cb) child.on('exit', (code, signal) => { if (code > 0) { - log.error( - 'prepare-git-dep', - Buffer.concat(errData, errDataLen).toString('utf8') - ) const err = new Error(`${signal}: npm exited with code ${code} while attempting to build ${manifest._requested}. Clone the repository manually and run 'npm install' in it for more information.`) err.code = code err.signal = signal @@ -156,6 +158,13 @@ function prepareAndPack (manifest, dir) { cb() } }) + }).then(() => { + if (outDataLen > 0) log.silly('prepareGitDep', '1>', Buffer.concat(outData, outDataLen).toString()) + if (errDataLen > 0) log.silly('prepareGitDep', '2>', Buffer.concat(errData, errDataLen).toString()) + }, (err) => { + if (outDataLen > 0) log.error('prepareGitDep', '1>', Buffer.concat(outData, outDataLen).toString()) + if (errDataLen > 0) log.error('prepareGitDep', '2>', Buffer.concat(errData, errDataLen).toString()) + throw err }) } }).then(() => { |