fixed one-off sessions not auto closing

This commit is contained in:
Eugene Pankov 2021-05-02 19:22:45 +02:00
parent f7b603a631
commit fe8dd891b4
No known key found for this signature in database
GPG key ID: 5896FCBBDD1CF4F4

View file

@ -147,6 +147,7 @@ export abstract class BaseSession {
/** @hidden */
export class Session extends BaseSession {
private pty: PTYProxy|null = null
private ptyClosed = false
private pauseAfterExit = false
private guessedCWD: string|null = null
private reportedCWD: string
@ -246,6 +247,7 @@ export class Session extends BaseSession {
})
this.pty.subscribe('close', () => {
this.ptyClosed = true
if (this.pauseAfterExit) {
this.emitOutput(Buffer.from('\r\nPress any key to close\r\n'))
} else if (this.open) {
@ -267,12 +269,11 @@ export class Session extends BaseSession {
}
write (data: Buffer): void {
if (this.ptyClosed) {
this.destroy()
}
if (this.open) {
this.pty?.write(data)
// TODO if (this.pty._writable) {
// } else {
// this.destroy()
// }
}
}