Optional output capture in task runner

pull/99/head
Piero Toffanin 2020-01-21 17:07:13 -05:00
rodzic 315589c2de
commit 0d61a82129
2 zmienionych plików z 8 dodań i 6 usunięć

Wyświetl plik

@ -276,8 +276,6 @@ module.exports = class Task{
done();
}else done(new Error(`Could not archive .zip file, 7z exited with code ${code}`));
}
}, output => {
this.output.push(output);
});
};
};

Wyświetl plik

@ -42,8 +42,10 @@ function makeRunner(command, args, requiredOptions = [], outputTestFile = null,
if (outputTestFile){
fs.readFile(path.resolve(__dirname, outputTestFile), 'utf8', (err, text) => {
if (!err){
let lines = text.split("\n");
lines.forEach(line => outputReceived(line));
if (outputReceived !== undefined){
let lines = text.split("\n");
lines.forEach(line => outputReceived(line));
}
done(null, 0, null);
}else{
@ -71,8 +73,10 @@ function makeRunner(command, args, requiredOptions = [], outputTestFile = null,
.on('exit', (code, signal) => done(null, code, signal))
.on('error', done);
childProcess.stdout.on('data', chunk => outputReceived(chunk.toString()));
childProcess.stderr.on('data', chunk => outputReceived(chunk.toString()));
if (outputReceived !== undefined){
childProcess.stdout.on('data', chunk => outputReceived(chunk.toString()));
childProcess.stderr.on('data', chunk => outputReceived(chunk.toString()));
}
return childProcess;
};