diff --git a/lib/child_process.js b/lib/child_process.js index 0d73beb5c5d6c7..9226d127b3b064 100644 --- a/lib/child_process.js +++ b/lib/child_process.js @@ -931,6 +931,7 @@ function normalizeSpawnArguments(file /*, args, options*/) { else if (!util.isObject(options)) throw new TypeError('options argument must be an object'); + options = util._extend({}, options); args.unshift(file); var env = options.env || process.env; diff --git a/test/common.js b/test/common.js index b9b03c738f7657..0cd9912f732cc7 100644 --- a/test/common.js +++ b/test/common.js @@ -97,6 +97,17 @@ exports.spawnCat = function(options) { }; +exports.spawnSyncCat = function(options) { + var spawnSync = require('child_process').spawnSync; + + if (process.platform === 'win32') { + return spawnSync('more', [], options); + } else { + return spawnSync('cat', [], options); + } +}; + + exports.spawnPwd = function(options) { var spawn = require('child_process').spawn; diff --git a/test/parallel/test-child-process-stdio.js b/test/parallel/test-child-process-stdio.js index 2e1875a18041d8..7292007f1a207e 100644 --- a/test/parallel/test-child-process-stdio.js +++ b/test/parallel/test-child-process-stdio.js @@ -13,3 +13,7 @@ child = common.spawnPwd(options); assert.equal(child.stdout, null); assert.equal(child.stderr, null); + +options = {stdio: 'ignore'}; +child = common.spawnSyncCat(options); +assert.deepEqual(options, {stdio: 'ignore'});