Browse Source

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

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

Fixes #5935.
v0.11.5-release
Ben Noordhuis 11 years ago
parent
commit
c13bfdc091
  1. 4
      doc/api/child_process.markdown
  2. 4
      lib/child_process.js

4
doc/api/child_process.markdown

@ -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')

4
lib/child_process.js

@ -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);
};

Loading…
Cancel
Save