From bb7b42efb41dd9a6bf5bbc86de7ecacb3a1c104b Mon Sep 17 00:00:00 2001 From: nightwing Date: Sun, 22 Feb 2015 18:00:42 +0400 Subject: [PATCH] Fetch localfs environment variables from the login shell (fixes +6151) --- node_modules/vfs-local/localfs.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/node_modules/vfs-local/localfs.js b/node_modules/vfs-local/localfs.js index 93701c70..36d0f3aa 100644 --- a/node_modules/vfs-local/localfs.js +++ b/node_modules/vfs-local/localfs.js @@ -129,7 +129,21 @@ module.exports = function setup(fsOptions) { } else { fsOptions.defaultEnv = process.env; } - + + // Fetch environment variables from the login shell + if (!isWin) { + _execFile(BASH, ["-lc", "printenv -0"], function(error, stdout, stderr) { + if (!error && !stderr && stdout) { + var env = fsOptions.defaultEnv; + stdout.split("\x00").forEach(function(entry) { + var i = entry.indexOf("="); + if (i != -1) + env[entry.slice(0, i)] = entry.slice(i + 1); + }); + } + }); + } + // Storage for extension APIs var apis = {}; // Storage for event handlers