diff --git a/lib/child_process.js b/lib/child_process.js index d19a0c0119..fb5c7fd8d7 100644 --- a/lib/child_process.js +++ b/lib/child_process.js @@ -164,10 +164,11 @@ ChildProcess.prototype.kill = function (sig) { ChildProcess.prototype.spawn = function (path, args, options, customFds) { args = args || []; - options = options || {}; var cwd, env; - if (options.cwd === undefined && options.env === undefined && options.customFds === undefined) { + if (!options || options.cwd === undefined && + options.env === undefined && + options.customFds === undefined) { // Deprecated API: (path, args, options, env, customFds) cwd = ""; env = options || process.env;