This repository has been archived by the owner. It is now read-only.

child_process.fork: don't modify args #1888

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants

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' ]
Member

bnoordhuis commented Oct 14, 2011

Good one. Patch LGTM.

koichik commented Oct 14, 2011

Thanks!

@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 subscribe to this conversation on GitHub. Already have an account? Sign in.