![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /proc/thread-self/root/usr/local/n/versions/node/14.15.4/lib/node_modules/npm/lib/utils/ |
Upload File : |
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) { var er = new Error('spawn ENOENT') er.code = 'ENOENT' er.errno = 'ENOENT' er.syscall = 'spawn' er.file = cmd cooked.emit('error', er) } else { cooked.emit('close', code, signal) } }) cooked.stdin = raw.stdin cooked.stdout = raw.stdout cooked.stderr = raw.stderr cooked.kill = function (sig) { return raw.kill(sig) } return cooked }