Debugging improvements

dev/git-series/gccdum
Matt Godbolt 6 years ago
parent 3a4b85ff56
commit 7a173dcf4f

@ -60,7 +60,7 @@ clean:
$(MAKE) -C c-preload clean
run: prereqs
$(NODE) ./node_modules/.bin/supervisor -w app.js,lib,etc/config -e 'js|node|properties' --exec $(NODE) -- ./app.js --language $(LANG)
$(NODE) ./node_modules/.bin/supervisor -w app.js,lib,etc/config -e 'js|node|properties' --exec $(NODE) -- ./app.js --language $(LANG) $(EXTRA_ARGS)
HASH := $(shell git rev-parse HEAD)
dist: prereqs

@ -51,9 +51,12 @@ var opts = nopt({
'host': [String],
'port': [Number],
'propDebug': [Boolean],
'debug': [Boolean],
'static': [String]
});
if (opts.debug) logger.level = 'debug';
// Set default values for omitted arguments
var rootDir = opts.rootDir || './etc';
var language = opts.language || "C++";

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

Loading…
Cancel
Save