Browse files

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.
  • Loading branch information...
1 parent c84b3c4 commit 024451c65cf0a1da4da48f99885cb8e7c2d20c72 @shlevy shlevy committed with piscisaureus Feb 12, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/child_process.js
View
2 lib/child_process.js
@@ -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.

0 comments on commit 024451c

Please sign in to comment.