Поправки spawnProcess

This commit is contained in:
Book Pauk
2019-02-27 21:31:47 +07:00
parent 3253858c7f
commit b786b7b2d6

View File

@@ -22,7 +22,7 @@ function spawnProcess(cmd, opts) {
return new Promise(async(resolve, reject) => { return new Promise(async(resolve, reject) => {
let resolved = false; let resolved = false;
const proc = spawn(cmd, args); const proc = spawn(cmd, args, {detached: true});
let stdout = ''; let stdout = '';
proc.stdout.on('data', (data) => { proc.stdout.on('data', (data) => {
@@ -46,8 +46,10 @@ function spawnProcess(cmd, opts) {
}); });
await sleep(killAfter); await sleep(killAfter);
if (!resolved) if (!resolved) {
process.kill(proc.pid);
reject({status: 'killed', stdout, stderr}); reject({status: 'killed', stdout, stderr});
}
}); });
} }