1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-12-28 21:13:18 +03:00

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

@ -436,6 +436,13 @@ export class SplitTabComponent extends BaseTabComponent implements OnInit, OnDes
this.splitAdjusted.next(spanner)
}
destroy () {
super.destroy()
for (const x of this.getAllTabs()) {
x.destroy()
}
}
private attachTabView (tab: BaseTabComponent) {
const ref = this.viewContainer.insert(tab.hostView) as EmbeddedViewRef<any> // eslint-disable-line @typescript-eslint/no-unnecessary-type-assertion
this.viewRefs.set(tab, ref)

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')
}
resolve()
}, 1000)
} catch {
resolve()
}
})
})