diff --git a/lib/ssh.js b/lib/ssh.js index 50b3583..f650413 100644 --- a/lib/ssh.js +++ b/lib/ssh.js @@ -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(); @@ -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;