-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
child_process.fork not passing along options.env #20749
Comments
Try: require('child_process').fork('./child.js', [], { env: { FOO: 'bar' } }); @nodejs/child_process Is this expected behavior that the second argument set in |
@vsemozhetbyt thanks - this also works:
I can guess why this is happening, having seen enough dodgy JS code that does parameter overloading ;) |
@vsemozhetbyt I think the check for arguments can be improved. Line 73 in 7f0f978
Line 74 in 7f0f978
We can check for emptiness (something like Or we can just document the behavior altogether. 😛 |
This looks like an ambiguity problem, and improving docs seems to be the logical way forward to me as well. |
As a developer, even if documented, this looks like broken behaviour. Throwing an error on an invalid argument type is perfectly acceptable, but ignoring the subsequent argument is just shoddy - to be tolerated in a third party lib but not a core Node module. Just my opinion. |
@borisovg if you insist, I could look a tad deeper into this over the course of the next few days and hack up a small PR. |
@shobhitchittora is this fixed yet? |
parent.js:
child.js
output:
The text was updated successfully, but these errors were encountered: