Add log message when killing subprocess
This commit is contained in:
parent
9d35984033
commit
d2a9d6faf6
@ -36,15 +36,14 @@ export class Subprocess {
|
||||
reject(new Error(`"${this.command}" exited with code ${code}`))
|
||||
}
|
||||
})
|
||||
let exited = false
|
||||
subprocess.on('exit', () => exited = true)
|
||||
subprocess.on('error', reject)
|
||||
|
||||
process.on('exit', () => {
|
||||
if (!exited) {
|
||||
subprocess.kill()
|
||||
}
|
||||
})
|
||||
const kill = () => {
|
||||
process.stderr.write(`Killing ${this.command} ${this.args.join(' ')}\n`)
|
||||
subprocess.kill()
|
||||
}
|
||||
process.on('exit', kill)
|
||||
subprocess.on('exit', () => process.removeListener('exit', kill))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user