Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
child_process.fork: don't modify args
Browse files Browse the repository at this point in the history
Fixes #1888.
  • Loading branch information
koichik committed Oct 14, 2011
1 parent e0297ca commit a09b747
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 3 additions & 1 deletion test/simple/test-child-process-fork.js
Original file line number Diff line number Diff line change
@@ -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;

Expand Down

0 comments on commit a09b747

Please sign in to comment.