kopia lustrzana https://github.com/c9/core
Merge pull request +10025 from c9/localfs-env
wait for reading env before calling spawnpull/223/head
commit
c6421a0820
|
@ -130,8 +130,12 @@ module.exports = function setup(fsOptions) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch environment variables from the login shell
|
// Fetch environment variables from the login shell
|
||||||
|
var waitForEnv = null;
|
||||||
if (!isWin) {
|
if (!isWin) {
|
||||||
|
waitForEnv = [];
|
||||||
_execFile(BASH, ["-lc", "printenv -0"], function(error, stdout, stderr) {
|
_execFile(BASH, ["-lc", "printenv -0"], function(error, stdout, stderr) {
|
||||||
|
var pending = waitForEnv;
|
||||||
|
waitForEnv = null;
|
||||||
if (!error && !stderr && stdout) {
|
if (!error && !stderr && stdout) {
|
||||||
var env = fsOptions.defaultEnv;
|
var env = fsOptions.defaultEnv;
|
||||||
stdout.split("\x00").forEach(function(entry) {
|
stdout.split("\x00").forEach(function(entry) {
|
||||||
|
@ -140,6 +144,7 @@ module.exports = function setup(fsOptions) {
|
||||||
env[entry.slice(0, i)] = entry.slice(i + 1);
|
env[entry.slice(0, i)] = entry.slice(i + 1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
pending.forEach(function(x) { x(); });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1447,6 +1452,9 @@ module.exports = function setup(fsOptions) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function spawn(executablePath, options, callback) {
|
function spawn(executablePath, options, callback) {
|
||||||
|
if (waitForEnv)
|
||||||
|
return waitForEnv.push(spawn.bind(null, executablePath, options, callback));
|
||||||
|
|
||||||
var args = options.args || [];
|
var args = options.args || [];
|
||||||
|
|
||||||
_setDefaultEnv(options);
|
_setDefaultEnv(options);
|
||||||
|
@ -2166,6 +2174,9 @@ module.exports = function setup(fsOptions) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function execFile(executablePath, options, callback) {
|
function execFile(executablePath, options, callback) {
|
||||||
|
if (waitForEnv)
|
||||||
|
return waitForEnv.push(execFile.bind(null, executablePath, options, callback));
|
||||||
|
|
||||||
if (isWin && execFileWin(executablePath, options, callback))
|
if (isWin && execFileWin(executablePath, options, callback))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue