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

child_process.fork: don't modify args #1888

wants to merge 1 commit into from

Conversation

koichik
Copy link

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

@bnoordhuis
Copy link
Member

Good one. Patch LGTM.

@koichik
Copy link
Author

koichik commented Oct 14, 2011

Thanks!

@koichik koichik closed this in a09b747 Oct 14, 2011
@ry
Copy link

ry commented Oct 14, 2011

Thanks koichik

@koichik
Copy link
Author

koichik commented Oct 14, 2011

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

@ry
Copy link

ry commented Oct 14, 2011

Yeah I will merge next week

@koichik
Copy link
Author

koichik commented Oct 14, 2011

Okay, thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants