Skip to content

Commit

Permalink
Merge pull request #125 from Dreamacro/fix-ssh-leak
Browse files Browse the repository at this point in the history
Fix SSH client leak bug
  • Loading branch information
apocas committed Sep 22, 2020
2 parents 4a96752 + 588619b commit 000b873
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/ssh.js
Expand Up @@ -6,7 +6,7 @@ module.exports = function(opt) {
var agent = new http.Agent();

agent.createConnection = function(options, fn) {
conn.on('ready', function() {
conn.once('ready', function() {
conn.exec('docker system dial-stdio', function(err, stream) {
if (err) {
conn.end();
Expand All @@ -16,14 +16,14 @@ module.exports = function(opt) {

fn(null, stream);

stream.on('close', () => {
stream.once('close', () => {
conn.end();
agent.destroy();
});
});
}).connect(opt);

conn.on('end', () => agent.destroy());
conn.once('end', () => agent.destroy());
};

return agent;
Expand Down

0 comments on commit 000b873

Please sign in to comment.