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

child_process.fork: don't modify args #1888

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/child_process.js
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
@@ -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