Browse Source

Simplify execution from "big if statement"

This code is functionally equivalent, but in a simpler form.  Now new
parameters to `execFile` do not require `exec` to be refactored.
v0.7.4-release
Travis Swicegood 14 years ago
committed by Ryan Dahl
parent
commit
22cf5a24db
  1. 8
      lib/child_process.js

8
lib/child_process.js

@ -12,11 +12,9 @@ var spawn = exports.spawn = function (path, args /*, options OR env, customFds *
}; };
exports.exec = function (command /*, options, callback */) { exports.exec = function (command /*, options, callback */) {
if (arguments.length < 3) { var _slice = Array.prototype.slice;
return exports.execFile("/bin/sh", ["-c", command], arguments[1]); var args = ["/bin/sh", ["-c", command]].concat(_slice.call(arguments, 1));
} else { return exports.execFile.apply(this, args)
return exports.execFile("/bin/sh", ["-c", command], arguments[1], arguments[2]);
}
}; };

Loading…
Cancel
Save