Browse Source

child_process.fork: don't modify args

Fixes #1888.
v0.7.4-release
koichik 13 years ago
parent
commit
a09b747f30
  1. 2
      lib/child_process.js
  2. 4
      test/simple/test-child-process-fork.js

2
lib/child_process.js

@ -124,7 +124,7 @@ function nop() { }
exports.fork = function(modulePath, args, options) { exports.fork = function(modulePath, args, options) {
if (!options) options = {}; if (!options) options = {};
if (!args) args = []; args = args ? args.slice(0) : [];
args.unshift(modulePath); args.unshift(modulePath);
if (options.stdinStream) { if (options.stdinStream) {

4
test/simple/test-child-process-fork.js

@ -1,8 +1,10 @@
var assert = require('assert'); var assert = require('assert');
var common = require('../common'); var common = require('../common');
var fork = require('child_process').fork; 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; var messageCount = 0;

Loading…
Cancel
Save