0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00

child_process: add 'shell' option to .exec()

No test, we can't rely on an alternate shell being available.

Fixes #5935.
This commit is contained in:
Ben Noordhuis 2013-07-29 16:20:24 +02:00
parent 38176d3a1a
commit c13bfdc091
2 changed files with 8 additions and 0 deletions

View File

@ -464,6 +464,10 @@ See also: `child_process.exec()` and `child_process.fork()`
* `cwd` {String} Current working directory of the child process
* `env` {Object} Environment key-value pairs
* `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)
* `maxBuffer` {Number} (Default: 200*1024)
* `killSignal` {String} (Default: 'SIGTERM')

View File

@ -576,6 +576,10 @@ exports.exec = function(command /*, options, callback */) {
file = '/bin/sh';
args = ['-c', command];
}
if (options && options.shell)
file = options.shell;
return exports.execFile(file, args, options, callback);
};