Fetch localfs environment variables from the login shell (fixes +6151)

pull/39/head
nightwing 2015-02-22 18:00:42 +04:00
rodzic cb8db3b002
commit bb7b42efb4
1 zmienionych plików z 15 dodań i 1 usunięć

16
node_modules/vfs-local/localfs.js wygenerowano vendored
Wyświetl plik

@ -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