From d54ce20514b1cdacb2b7e752371ce8f4040cf8fb Mon Sep 17 00:00:00 2001 From: mbroinsky Date: Fri, 1 Dec 2023 12:08:27 -0300 Subject: [PATCH] Adding events handlers for ssh2 Adding "close" and "end" events handlers to sshClient to detect server side disconnect. --- src/core/remote-client/sshClient.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core/remote-client/sshClient.ts b/src/core/remote-client/sshClient.ts index fc259e80..84a90615 100644 --- a/src/core/remote-client/sshClient.ts +++ b/src/core/remote-client/sshClient.ts @@ -301,6 +301,8 @@ export default class SSHClient extends RemoteClient { .on('error', err => { reject(new Error(`[${option.host}]: ${err.message}`)); }) + .on('close', this.end()) + .on('end', this.end()) .connect({ keepaliveInterval: 1000 * 30, // 30 secs, original // keepaliveInterval: 1000 * 600, // 10 mins