child_process.fork: don't modify args #1888

Closed
wants to merge 1 commit into
from

Projects

None yet

3 participants

@koichik
koichik commented Oct 14, 2011

Because child_process.fork() modify args argument, the worker processes after the second cannot get right arguments with cluster.
example:

a.js

console.log(process.env.NODE_WORKER_ID, process.argv);

result:

$ node cluster a.js foo bar
Detected 2 cpus
Worker 5097 online
Worker 5098 online
1 [ '/home/koichik/git/joyent/node/out/Release/node',
  '/tmp/a.js',
  'foo',
  'bar' ]
2 [ '/home/koichik/git/joyent/node/out/Release/node',
  '/tmp/a.js',
  '/tmp/a.js',
  'foo',
  'bar' ]
Owner

Good one. Patch LGTM.

koichik commented Oct 14, 2011

Thanks!

@koichik koichik added a commit that closed this pull request Oct 14, 2011
@koichik koichik child_process.fork: don't modify args
Fixes #1888.
a09b747
@koichik koichik closed this in a09b747 Oct 14, 2011
ry commented Oct 14, 2011

Thanks koichik

koichik commented Oct 14, 2011

@ry - My pleasure. BTW, do you have a plan to merge v0.4 branch to the master?

ry commented Oct 14, 2011

Yeah I will merge next week

koichik commented Oct 14, 2011

Okay, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment