fork: don't clear environment by default

- Set options.env to process.env instead of {} by default.
- Shallow clone the passed options.env in case the user passed process.env directly.
This commit is contained in:
Shea Levy 2012-02-12 19:50:19 -05:00 committed by Bert Belder
parent c84b3c4b73
commit 024451c65c

View File

@ -193,7 +193,7 @@ exports.fork = function(modulePath /*, args, options*/) {
// Just need to set this - child process won't actually use the fd.
// For backwards compat - this can be changed to 'NODE_CHANNEL' before v0.6.
if (!options.env) options.env = { };
options.env = util._extend({}, options.env || process.env);
options.env.NODE_CHANNEL_FD = 42;
// stdin is the IPC channel.