diff --git a/lib/child_process.js b/lib/child_process.js index f7312215cd..eec0313337 100644 --- a/lib/child_process.js +++ b/lib/child_process.js @@ -695,8 +695,16 @@ exports.execFile = function(file /* args, options, callback */) { }; -var spawn = exports.spawn = function(file, args, options) { - args = args ? args.slice(0) : []; +var spawn = exports.spawn = function(file /*, args, options*/) { + var args, options; + if (Array.isArray(arguments[1])) { + args = arguments[1].slice(0); + options = arguments[2]; + } else { + args = []; + options = arguments[1]; + } + args.unshift(file); var env = (options ? options.env : null) || process.env;