'online' logs from subprocess

This commit is contained in:
dogbert911
2022-03-31 21:25:35 +03:00
committed by GitHub
parent f0ad308283
commit 37a055c776

View File

@@ -26,14 +26,13 @@
* ================================================================================================================== */ * ================================================================================================================== */
const { exec } = require("child_process"); const { exec } = require("child_process");
function run(cmd) { function run(cmdline) {
exec(cmd, (error, stdout, stderr) => { var args = cmdline.split(' ');
if ( stdout.length !== 0 ) { console.log(`${stdout}`); } const cmd = args.shift();
if ( stderr.length !== 0 ) { console.error(`${stderr}`); }
if (error) { const subprocess = spawn(cmd, args, { stdio: 'inherit' });
process.exitCode = error.code; subprocess.on('exit', (exit_code) => {
console.error(`${error}`); process.exitCode = exit_code
}
}); });
} }