Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

child_process.fork: don't modify args

  • Loading branch information...
commit 175a2865198a55cbe1c32d8db756411b1af600ab 1 parent 33b5f2f
Koichi Kobayashi authored
2  lib/child_process.js
@@ -124,7 +124,7 @@ function nop() { }
124 124 exports.fork = function(modulePath, args, options) {
125 125 if (!options) options = {};
126 126
127   - if (!args) args = [];
  127 + args = args ? args.slice(0) : [];
128 128 args.unshift(modulePath);
129 129
130 130 if (options.stdinStream) {
4 test/simple/test-child-process-fork.js
... ... @@ -1,8 +1,10 @@
1 1 var assert = require('assert');
2 2 var common = require('../common');
3 3 var fork = require('child_process').fork;
  4 +var args = ['foo', 'bar'];
4 5
5   -var n = fork(common.fixturesDir + '/child-process-spawn-node.js');
  6 +var n = fork(common.fixturesDir + '/child-process-spawn-node.js', args);
  7 +assert.deepEqual(args, ['foo', 'bar']);
6 8
7 9 var messageCount = 0;
8 10

0 comments on commit 175a286

Please sign in to comment.
Something went wrong with that request. Please try again.