diff --git a/lib/node-gyp.js b/lib/node-gyp.js index 9d24103900..5c021ddd75 100644 --- a/lib/node-gyp.js +++ b/lib/node-gyp.js @@ -3,6 +3,7 @@ const path = require('path') const nopt = require('nopt') const log = require('npmlog') +const split = require('split2') const childProcess = require('child_process') const EE = require('events').EventEmitter const inherits = require('util').inherits @@ -166,10 +167,18 @@ proto.spawn = function spawn (command, args, opts) { if (!opts) { opts = {} } + + var cp = childProcess.spawn(command, args, opts) + if (!opts.silent && !opts.stdio) { - opts.stdio = [0, 1, 2] + cp.stdout.pipe(split()).on('data', function (line) { + log.notice('spawn stdout', line) + }) + cp.stderr.pipe(split()).on('data', function (line) { + log.error('spawn stderr', line) + }) } - var cp = childProcess.spawn(command, args, opts) + log.info('spawn', command) log.info('spawn args', args) return cp diff --git a/package.json b/package.json index 243738506d..2e86762a83 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "request": "^2.88.0", "rimraf": "^2.6.3", "semver": "^5.7.1", + "split2": "^3.1.1", "tar": "^4.4.12", "which": "^1.3.1" },