From 2b8bb47aed84fac602a56b87e7e2536422e96601 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Thu, 19 Mar 2020 12:47:38 +0100 Subject: [PATCH] lint --- terminus-ssh/src/api.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/terminus-ssh/src/api.ts b/terminus-ssh/src/api.ts index 3f62cf4a..d363ac56 100644 --- a/terminus-ssh/src/api.ts +++ b/terminus-ssh/src/api.ts @@ -245,14 +245,16 @@ export class SSHSession extends BaseSession { socket.destroy() return } - stream.pipe(socket) - socket.pipe(stream) - stream.on('close', () => { - socket.destroy() - }) - socket.on('close', () => { - stream.close() - }) + if (stream) { + stream.pipe(socket) + socket.pipe(stream) + stream.on('close', () => { + socket.destroy() + }) + socket.on('close', () => { + stream.close() + }) + } } ) }).then(() => {