wait for reading env before calling spawn

pull/223/head
nightwing 2015-10-23 12:27:54 +00:00
rodzic 903ab6f1d8
commit 915716e241
1 zmienionych plików z 13 dodań i 0 usunięć

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

@ -130,8 +130,12 @@ module.exports = function setup(fsOptions) {
}
// Fetch environment variables from the login shell
var waitForEnv = null;
if (!isWin) {
waitForEnv = [];
_execFile(BASH, ["-lc", "printenv -0"], function(error, stdout, stderr) {
var pending = waitForEnv;
waitForEnv = null;
if (!error && !stderr && stdout) {
var env = fsOptions.defaultEnv;
stdout.split("\x00").forEach(function(entry) {
@ -140,6 +144,9 @@ module.exports = function setup(fsOptions) {
env[entry.slice(0, i)] = entry.slice(i + 1);
});
}
pending.forEach(function(item) {
item[0].apply(null, item[1]);
});
});
}
@ -1444,6 +1451,9 @@ module.exports = function setup(fsOptions) {
}
function spawn(executablePath, options, callback) {
if (waitForEnv)
return waitForEnv.push([spawn, [executablePath, options, callback]]);
var args = options.args || [];
if (options.hasOwnProperty('env')) {
@ -2218,6 +2228,9 @@ module.exports = function setup(fsOptions) {
}
function execFile(executablePath, options, callback) {
if (waitForEnv)
return waitForEnv.push([execFile, [executablePath, options, callback]]);
if (isWin && execFileWin(executablePath, options, callback))
return;
if (options.hasOwnProperty('env')) {