summaryrefslogtreecommitdiff
path: root/deps/npm/lib/utils/spawn.js
diff options
context:
space:
mode:
authorRebecca Turner <me@re-becca.org>2016-06-24 13:43:51 -0700
committerJeremiah Senkpiel <fishrock123@rocketmail.com>2016-06-27 11:46:15 +0200
commitd538811fc8b920f3f36d5f21a4c23e270367ceb0 (patch)
tree11cee6c00aa843f16a71819039396f80bf6abe22 /deps/npm/lib/utils/spawn.js
parent1db31a34948eee311abd9881bbf5d906d0cd678b (diff)
downloadandroid-node-v8-d538811fc8b920f3f36d5f21a4c23e270367ceb0.tar.gz
android-node-v8-d538811fc8b920f3f36d5f21a4c23e270367ceb0.tar.bz2
android-node-v8-d538811fc8b920f3f36d5f21a4c23e270367ceb0.zip
deps: upgrade npm to 3.10.2
Contains the following npm releases: - https://github.com/npm/npm/releases/tag/v3.9.6 - https://github.com/npm/npm/releases/tag/v3.10.0 - https://github.com/npm/npm/releases/tag/v3.10.1 - https://github.com/npm/npm/releases/tag/v3.10.2 PR-URL: https://github.com/nodejs/node/pull/7410 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Diffstat (limited to 'deps/npm/lib/utils/spawn.js')
-rw-r--r--deps/npm/lib/utils/spawn.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/deps/npm/lib/utils/spawn.js b/deps/npm/lib/utils/spawn.js
index e389d83e02..b164a6acba 100644
--- a/deps/npm/lib/utils/spawn.js
+++ b/deps/npm/lib/utils/spawn.js
@@ -2,15 +2,31 @@ module.exports = spawn
var _spawn = require('child_process').spawn
var EventEmitter = require('events').EventEmitter
+var npwr = require('./no-progress-while-running.js')
+
+function willCmdOutput (stdio) {
+ if (stdio === 'inherit') return true
+ if (!Array.isArray(stdio)) return false
+ for (var fh = 1; fh <= 2; ++fh) {
+ if (stdio[fh] === 'inherit') return true
+ if (stdio[fh] === 1 || stdio[fh] === 2) return true
+ }
+ return false
+}
function spawn (cmd, args, options) {
+ var cmdWillOutput = willCmdOutput(options && options.stdio)
+
+ if (cmdWillOutput) npwr.startRunning()
var raw = _spawn(cmd, args, options)
var cooked = new EventEmitter()
raw.on('error', function (er) {
+ if (cmdWillOutput) npwr.stopRunning()
er.file = cmd
cooked.emit('error', er)
}).on('close', function (code, signal) {
+ if (cmdWillOutput) npwr.stopRunning()
// Create ENOENT error because Node.js v0.8 will not emit
// an `error` event if the command could not be found.
if (code === 127) {