|
|
|
@ -289,6 +289,7 @@ Compile.prototype.exec = function (command, args, options) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var okToCache = true;
|
|
|
|
|
logger.debug({type: "executing", command: command, args: args});
|
|
|
|
|
var child = child_process.spawn(command, args, {
|
|
|
|
|
env: env,
|
|
|
|
|
detached: process.platform == 'linux'
|
|
|
|
@ -324,19 +325,22 @@ Compile.prototype.exec = function (command, args, options) {
|
|
|
|
|
});
|
|
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
|
|
child.on('error', function (e) {
|
|
|
|
|
logger.debug("Error with " + command + "args", args, ":", e);
|
|
|
|
|
reject(e);
|
|
|
|
|
});
|
|
|
|
|
child.on('exit', function (code) {
|
|
|
|
|
if (timeout !== undefined) clearTimeout(timeout);
|
|
|
|
|
var result = {
|
|
|
|
|
code: code,
|
|
|
|
|
stdout: stdout,
|
|
|
|
|
stderr: stderr,
|
|
|
|
|
okToCache: okToCache
|
|
|
|
|
};
|
|
|
|
|
logger.debug({type: "executed", command: command, args: args, result: result});
|
|
|
|
|
// Why is this apparently needed in some cases (e.g. when I used to use this to do getMultiarch)?
|
|
|
|
|
// Without it, I apparently get stdout/stderr callbacks *after* the exit...
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
resolve({
|
|
|
|
|
code: code,
|
|
|
|
|
stdout: stdout,
|
|
|
|
|
stderr: stderr,
|
|
|
|
|
okToCache: okToCache
|
|
|
|
|
});
|
|
|
|
|
resolve(result);
|
|
|
|
|
}, 0);
|
|
|
|
|
});
|
|
|
|
|
if (options.input) child.stdin.write(options.input);
|
|
|
|
|