mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-18 10:30:01 +00:00
fixed one-off sessions not auto closing
This commit is contained in:
parent
f7b603a631
commit
fe8dd891b4
@ -147,6 +147,7 @@ export abstract class BaseSession {
|
|||||||
/** @hidden */
|
/** @hidden */
|
||||||
export class Session extends BaseSession {
|
export class Session extends BaseSession {
|
||||||
private pty: PTYProxy|null = null
|
private pty: PTYProxy|null = null
|
||||||
|
private ptyClosed = false
|
||||||
private pauseAfterExit = false
|
private pauseAfterExit = false
|
||||||
private guessedCWD: string|null = null
|
private guessedCWD: string|null = null
|
||||||
private reportedCWD: string
|
private reportedCWD: string
|
||||||
@ -246,6 +247,7 @@ export class Session extends BaseSession {
|
|||||||
})
|
})
|
||||||
|
|
||||||
this.pty.subscribe('close', () => {
|
this.pty.subscribe('close', () => {
|
||||||
|
this.ptyClosed = true
|
||||||
if (this.pauseAfterExit) {
|
if (this.pauseAfterExit) {
|
||||||
this.emitOutput(Buffer.from('\r\nPress any key to close\r\n'))
|
this.emitOutput(Buffer.from('\r\nPress any key to close\r\n'))
|
||||||
} else if (this.open) {
|
} else if (this.open) {
|
||||||
@ -267,12 +269,11 @@ export class Session extends BaseSession {
|
|||||||
}
|
}
|
||||||
|
|
||||||
write (data: Buffer): void {
|
write (data: Buffer): void {
|
||||||
|
if (this.ptyClosed) {
|
||||||
|
this.destroy()
|
||||||
|
}
|
||||||
if (this.open) {
|
if (this.open) {
|
||||||
this.pty?.write(data)
|
this.pty?.write(data)
|
||||||
// TODO if (this.pty._writable) {
|
|
||||||
// } else {
|
|
||||||
// this.destroy()
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user