Attempt at fixing #228

dev/git-series/gccdum
Matt Godbolt 6 years ago
parent 25ec2a2c0b
commit 5c46064374

@ -289,6 +289,12 @@ Compile.prototype.exec = function (command, args, options) {
streams.stderr += "\nKilled - processing time exceeded";
}, timeoutMs);
function setupOnError(stream, name) {
stream.on('error', function (err) {
logger.error('Error with ' + name + ' stream:', err);
});
}
function setupStream(stream, name) {
stream.on('data', function (data) {
if (streams.truncated) return;
@ -300,11 +306,10 @@ Compile.prototype.exec = function (command, args, options) {
}
streams[name] += data;
});
stream.on('error', function (err) {
logger.error('Error with stream:', err);
});
setupOnError(stream, name);
}
setupOnError(child.stdin, 'stdin');
setupStream(child.stdout, 'stdout');
setupStream(child.stderr, 'stderr');
child.on('exit', function (code) {

Loading…
Cancel
Save