Skip to content

Commit d5e71c1

Browse files
authored
fix: ssh transport econnreset (#272)
1 parent 9e72857 commit d5e71c1

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

lib/transports/sshTransport.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ function sshCall(config, xmlIn, done) {
3434
console.log('SSH CLIENT ERROR: ', error);
3535
}
3636
client.end();
37+
client.destroy();
3738
done(error, null);
3839
});
3940

@@ -79,6 +80,7 @@ function sshCall(config, xmlIn, done) {
7980
return;
8081
}
8182
client.end();
83+
client.destroy();
8284
done(null, xmlOut);
8385
});
8486

test/functional/checkObjectExists.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,15 @@ function checkObjectExistsSSH(config, object = {}, callback) {
3131
if (config.verbose) { console.log(`Command exited abnormally with code: ${checkLibCode}`); }
3232
const libError = new Error(`${lib} lib was not found!\nCreate it by running: ${createLib}`);
3333
client.end();
34+
client.destroy();
3435
callback(libError, false);
3536
return;
3637
}
3738
client.exec(checkObjectCommand, (checkObjectError, checkObjectStream) => {
3839
if (config.verbose) { console.log(`executing ${checkObjectCommand}`); }
3940
if (checkObjectError) {
4041
client.end();
42+
client.destroy();
4143
callback(checkLibError, false);
4244
return;
4345
}
@@ -47,12 +49,14 @@ function checkObjectExistsSSH(config, object = {}, callback) {
4749
checkObjectStream.on('exit', (checkObjectCode) => {
4850
if (checkObjectCode !== 0) {
4951
client.end();
52+
client.destroy();
5053
console.log(`Command exited abnormally with code: ${checkObjectCode}`);
5154
const objectError = new Error(`${object.name} was not found!\nCreate it by running: ${object.createObject}`);
5255
callback(objectError);
5356
return;
5457
}
5558
client.end();
59+
client.destroy();
5660
callback(null, true);
5761
});
5862
});

0 commit comments

Comments
 (0)