Skip to content

Commit

Permalink
fix: ssh transport econnreset (#272)
Browse files Browse the repository at this point in the history
  • Loading branch information
abmusse committed Apr 30, 2020
1 parent 9e72857 commit d5e71c1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/transports/sshTransport.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function sshCall(config, xmlIn, done) {
console.log('SSH CLIENT ERROR: ', error);
}
client.end();
client.destroy();
done(error, null);
});

Expand Down Expand Up @@ -79,6 +80,7 @@ function sshCall(config, xmlIn, done) {
return;
}
client.end();
client.destroy();
done(null, xmlOut);
});

Expand Down
4 changes: 4 additions & 0 deletions test/functional/checkObjectExists.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ function checkObjectExistsSSH(config, object = {}, callback) {
if (config.verbose) { console.log(`Command exited abnormally with code: ${checkLibCode}`); }
const libError = new Error(`${lib} lib was not found!\nCreate it by running: ${createLib}`);
client.end();
client.destroy();
callback(libError, false);
return;
}
client.exec(checkObjectCommand, (checkObjectError, checkObjectStream) => {
if (config.verbose) { console.log(`executing ${checkObjectCommand}`); }
if (checkObjectError) {
client.end();
client.destroy();
callback(checkLibError, false);
return;
}
Expand All @@ -47,12 +49,14 @@ function checkObjectExistsSSH(config, object = {}, callback) {
checkObjectStream.on('exit', (checkObjectCode) => {
if (checkObjectCode !== 0) {
client.end();
client.destroy();
console.log(`Command exited abnormally with code: ${checkObjectCode}`);
const objectError = new Error(`${object.name} was not found!\nCreate it by running: ${object.createObject}`);
callback(objectError);
return;
}
client.end();
client.destroy();
callback(null, true);
});
});
Expand Down

0 comments on commit d5e71c1

Please sign in to comment.