kopia lustrzana https://github.com/c9/core
wait for reading env before calling spawn
rodzic
903ab6f1d8
commit
915716e241
|
@ -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')) {
|
||||
|
|
Ładowanie…
Reference in New Issue