Skip to content

Commit

Permalink
Merge pull request #16 from fsmanuel/fix/fast-put
Browse files Browse the repository at this point in the history
Close sftp channels/connections
  • Loading branch information
arenoir authored Jul 20, 2018
2 parents b69204e + b7adc75 commit cf039bd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/ssh-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ module.exports = CoreObject.extend({

stream.on('error', reject);
stream.on('finish', resolve);
stream.on('close', function() {
sftp.end();
});
stream.write(data);
stream.end();
});
Expand All @@ -77,6 +80,8 @@ module.exports = CoreObject.extend({
}

sftp.readFile(path, {}, function (error, data) {
sftp.end();

if (error) {
reject(error);
} else {
Expand Down Expand Up @@ -120,6 +125,8 @@ module.exports = CoreObject.extend({
}

sftp.fastPut(src, dest, {}, function (err) {
sftp.end();

if (err) {
reject(err);
}
Expand Down

0 comments on commit cf039bd

Please sign in to comment.