From 9b5b5a9d0031e93d79af275c486ebda40b545b46 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Sat, 13 Feb 2021 12:47:21 +0100 Subject: [PATCH] re-fixed session restarting --- .../src/components/serialTab.component.ts | 12 +++++------- terminus-ssh/src/components/sshTab.component.ts | 11 +++++++---- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/terminus-serial/src/components/serialTab.component.ts b/terminus-serial/src/components/serialTab.component.ts index fd1513c1..9e2b14dd 100644 --- a/terminus-serial/src/components/serialTab.component.ts +++ b/terminus-serial/src/components/serialTab.component.ts @@ -97,13 +97,11 @@ export class SerialTabComponent extends BaseTerminalTabComponent { })) this.attachSessionHandler(this.session!.destroyed$.subscribe(() => { this.write('Press any key to reconnect\r\n') - setTimeout(() => { - this.input$.pipe(first()).subscribe(() => { - if (!this.session?.open) { - this.reconnect() - } - }) - }, 100) + this.input$.pipe(first()).subscribe(() => { + if (!this.session?.open) { + this.reconnect() + } + }) })) super.attachSessionHandlers() } diff --git a/terminus-ssh/src/components/sshTab.component.ts b/terminus-ssh/src/components/sshTab.component.ts index a0f17f88..3d95c1b4 100644 --- a/terminus-ssh/src/components/sshTab.component.ts +++ b/terminus-ssh/src/components/sshTab.component.ts @@ -54,6 +54,9 @@ export class SSHTabComponent extends BaseTerminalTabComponent { case 'end': this.sendInput('\x1b[F' ) break + case 'restart-ssh-session': + this.reconnect() + break } }) @@ -157,11 +160,11 @@ export class SSHTabComponent extends BaseTerminalTabComponent { if (!this.reconnectOffered) { this.reconnectOffered = true this.write('Press any key to reconnect\r\n') - setTimeout(() => { - this.attachSessionHandler(this.input$.pipe(first()).subscribe(() => { + this.input$.pipe(first()).subscribe(() => { + if (!this.session?.open) { this.reconnect() - })) - }, 100) + } + }) } } }))