1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-12-29 13:35:34 +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) this.splitAdjusted.next(spanner)
} }
destroy () {
super.destroy()
for (const x of this.getAllTabs()) {
x.destroy()
}
}
private attachTabView (tab: BaseTabComponent) { private attachTabView (tab: BaseTabComponent) {
const ref = this.viewContainer.insert(tab.hostView) as EmbeddedViewRef<any> // eslint-disable-line @typescript-eslint/no-unnecessary-type-assertion const ref = this.viewContainer.insert(tab.hostView) as EmbeddedViewRef<any> // eslint-disable-line @typescript-eslint/no-unnecessary-type-assertion
this.viewRefs.set(tab, ref) this.viewRefs.set(tab, ref)

View File

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