Permalink
Browse files

child_process.fork: don't modify args

  • Loading branch information...
1 parent 33b5f2f commit 175a2865198a55cbe1c32d8db756411b1af600ab @koichik committed Oct 14, 2011
Showing with 4 additions and 2 deletions.
  1. +1 −1 lib/child_process.js
  2. +3 −1 test/simple/test-child-process-fork.js
@@ -124,7 +124,7 @@ function nop() { }
exports.fork = function(modulePath, args, options) {
if (!options) options = {};
- if (!args) args = [];
+ args = args ? args.slice(0) : [];
args.unshift(modulePath);
if (options.stdinStream) {
@@ -1,8 +1,10 @@
var assert = require('assert');
var common = require('../common');
var fork = require('child_process').fork;
+var args = ['foo', 'bar'];
-var n = fork(common.fixturesDir + '/child-process-spawn-node.js');
+var n = fork(common.fixturesDir + '/child-process-spawn-node.js', args);
+assert.deepEqual(args, ['foo', 'bar']);
var messageCount = 0;

0 comments on commit 175a286

Please sign in to comment.