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
diff options
context:
space:
mode:
authorRebecca Turner <me@re-becca.org>2017-05-16 03:25:05 +0300
committerRebecca Turner <me@re-becca.org>2017-05-26 04:55:21 +0300
commit3c3428277b2d045d9eabd6826125f6055d174ff7 (patch)
tree0775d7aeac32c75aec5e2ee74ab6a23a8509aba9
parentebbe7a0d005619d4ae3f54eb4b90ac4fac738abb (diff)
git-prepare: Fix child process npm run
Previously it used the global npm, not the npm we were running from.
-rw-r--r--lib/config/pacote.js19
-rw-r--r--test/tap/git-prepare.js (renamed from test/need-npm5-update/git-prepare.js)1
2 files changed, 15 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(() => {
diff --git a/test/need-npm5-update/git-prepare.js b/test/tap/git-prepare.js
index ae12bb518..1a61056b4 100644
--- a/test/need-npm5-update/git-prepare.js
+++ b/test/tap/git-prepare.js
@@ -94,6 +94,7 @@ test('install from git repo with prepare script', function (t) {
common.npm([
'install',
+ '--no-save',
'--registry', common.registry,
'--cache', cache,
'--loglevel', 'error'