mirror of https://github.com/nodejs/node.git
child_process: add 'shell' option to .exec()
No test, we can't rely on an alternate shell being available. Fixes #5935.archived-io.js-v0.10
parent
38176d3a1a
commit
c13bfdc091
|
@ -464,6 +464,10 @@ See also: `child_process.exec()` and `child_process.fork()`
|
||||||
* `cwd` {String} Current working directory of the child process
|
* `cwd` {String} Current working directory of the child process
|
||||||
* `env` {Object} Environment key-value pairs
|
* `env` {Object} Environment key-value pairs
|
||||||
* `encoding` {String} (Default: 'utf8')
|
* `encoding` {String} (Default: 'utf8')
|
||||||
|
* `shell` {String} Shell to execute the command with
|
||||||
|
(Default: '/bin/sh' on UNIX, 'cmd.exe' on Windows, The shell should
|
||||||
|
understand the `-c` switch on UNIX or `/s /c` on Windows. On Windows,
|
||||||
|
command line parsing should be compatible with `cmd.exe`.)
|
||||||
* `timeout` {Number} (Default: 0)
|
* `timeout` {Number} (Default: 0)
|
||||||
* `maxBuffer` {Number} (Default: 200*1024)
|
* `maxBuffer` {Number} (Default: 200*1024)
|
||||||
* `killSignal` {String} (Default: 'SIGTERM')
|
* `killSignal` {String} (Default: 'SIGTERM')
|
||||||
|
|
|
@ -576,6 +576,10 @@ exports.exec = function(command /*, options, callback */) {
|
||||||
file = '/bin/sh';
|
file = '/bin/sh';
|
||||||
args = ['-c', command];
|
args = ['-c', command];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options && options.shell)
|
||||||
|
file = options.shell;
|
||||||
|
|
||||||
return exports.execFile(file, args, options, callback);
|
return exports.execFile(file, args, options, callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue