From 024451c65cf0a1da4da48f99885cb8e7c2d20c72 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Sun, 12 Feb 2012 19:50:19 -0500 Subject: [PATCH] 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. --- lib/child_process.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/child_process.js b/lib/child_process.js index d04e98b2910..c6a2a94bc53 100644 --- a/lib/child_process.js +++ b/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.