Skip to content

Commit

Permalink
fix: ssh transport silent failure (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
abmusse committed Apr 17, 2020
1 parent dddbbed commit 6e3b8a0
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions lib/transports/sshTransport.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ function sshCall(config, xmlIn, done) {
verbose = false,
} = config;

let ERROR;
let xmlOut = '';
const xmlBuffer = Buffer.from(xmlIn);

Expand All @@ -33,8 +32,8 @@ function sshCall(config, xmlIn, done) {
if (verbose) {
console.log('SSH CLIENT ERROR: ', error);
}
ERROR = error;
client.end();
done(error, null);
});

client.on('close', () => {
Expand All @@ -47,13 +46,6 @@ function sshCall(config, xmlIn, done) {
if (verbose) {
console.log('SSH Client has ended');
}

if (ERROR) {
done(ERROR, null);
return;
}

done(null, xmlOut);
});

client.on('ready', () => {
Expand Down Expand Up @@ -86,6 +78,7 @@ function sshCall(config, xmlIn, done) {
return;
}
client.end();
done(null, xmlOut);
});

stream.stdin.on('end', () => {
Expand Down

0 comments on commit 6e3b8a0

Please sign in to comment.