Skip to content

Commit 588619b

Browse files
committed
fix SSH client leak bug
1 parent 4a96752 commit 588619b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/ssh.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = function(opt) {
66
var agent = new http.Agent();
77

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

1717
fn(null, stream);
1818

19-
stream.on('close', () => {
19+
stream.once('close', () => {
2020
conn.end();
2121
agent.destroy();
2222
});
2323
});
2424
}).connect(opt);
2525

26-
conn.on('end', () => agent.destroy());
26+
conn.once('end', () => agent.destroy());
2727
};
2828

2929
return agent;

0 commit comments

Comments
 (0)