fixed shell process not being killed on tab close

This commit is contained in:
Eugene Pankov
2019-12-31 13:01:37 +01:00
parent 94d91f8182
commit 7b6cdb274c
2 changed files with 13 additions and 6 deletions

View File

@@ -255,15 +255,15 @@ export class Session extends BaseSession {
await new Promise((resolve) => {
this.kill('SIGTERM')
setImmediate(() => {
if (!this.open) {
resolve()
} else {
try {
process.kill(this.pty.pid, 0)
// still alive
setTimeout(() => {
if (this.open) {
this.kill('SIGKILL')
}
this.kill('SIGKILL')
resolve()
}, 1000)
} catch {
resolve()
}
})
})