From 6a1af942085ac0cd5f1da50a2795e3b2bae7f4bb Mon Sep 17 00:00:00 2001 From: Phil Gengler Date: Sun, 19 Nov 2023 12:27:15 -0500 Subject: [PATCH] 'return' after rejecting because of an error --- lib/ssh-client.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/ssh-client.js b/lib/ssh-client.js index 6e52c26..190774f 100644 --- a/lib/ssh-client.js +++ b/lib/ssh-client.js @@ -43,6 +43,7 @@ class SSHClient { this.client.sftp((error, sftp) => { if (error) { reject(error); + return; } let stream = sftp.createWriteStream(path); @@ -60,6 +61,7 @@ class SSHClient { this.client.sftp((error, sftp) => { if (error) { reject(error); + return; } sftp.readFile(path, { }, function(error, data) { @@ -78,6 +80,7 @@ class SSHClient { this.client.exec(command, (err/*, stream*/) => { if (err) { reject(err); + return; } resolve(); }); @@ -95,11 +98,13 @@ class SSHClient { this.client.sftp(function (err, sftp) { if (err) { reject(err); + return; } sftp.fastPut(src, dest, {}, function (err) { if (err) { reject(err); + return; } resolve(); });