mirror of https://github.com/nodejs/node.git
Add execFile() for Orlando
Undocumented for now, but basically like exec() with args.pull/22966/head
parent
9cf2a02d8b
commit
4efe27bbab
|
@ -10,8 +10,15 @@ var spawn = exports.spawn = function (path, args, env) {
|
|||
return child;
|
||||
};
|
||||
|
||||
exports.exec = function (command /*, options, callback */) {
|
||||
if (arguments.length < 3) {
|
||||
return exports.execFile("/bin/sh", ["-c", command], arguments[1]);
|
||||
} else {
|
||||
return exports.execFile("/bin/sh", ["-c", command], arguments[1], arguments[2]);
|
||||
}
|
||||
};
|
||||
|
||||
exports.exec = function (command /* , options, callback */) {
|
||||
exports.execFile = function (file, args /*, options, callback */) {
|
||||
var options = { encoding: 'utf8'
|
||||
, timeout: 0
|
||||
, maxBuffer: 200*1024
|
||||
|
@ -19,15 +26,16 @@ exports.exec = function (command /* , options, callback */) {
|
|||
};
|
||||
|
||||
var callback = arguments[arguments.length-1];
|
||||
if (typeof arguments[1] == 'object') {
|
||||
|
||||
if (typeof arguments[2] == 'object') {
|
||||
var keys = Object.keys(options);
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var k = keys[i];
|
||||
if (arguments[1][k] !== undefined) options[k] = arguments[1][k];
|
||||
if (arguments[2][k] !== undefined) options[k] = arguments[2][k];
|
||||
}
|
||||
}
|
||||
|
||||
var child = spawn("/bin/sh", ["-c", command]);
|
||||
var child = spawn(file, args);
|
||||
var stdout = "";
|
||||
var stderr = "";
|
||||
var killed = false;
|
||||
|
|
Loading…
Reference in New Issue