{"action":"created","issue":{"url":"https://api.github.com/repos/mscdex/ssh2/issues/379","repository_url":"https://api.github.com/repos/mscdex/ssh2","labels_url":"https://api.github.com/repos/mscdex/ssh2/issues/379/labels{/name}","comments_url":"https://api.github.com/repos/mscdex/ssh2/issues/379/comments","events_url":"https://api.github.com/repos/mscdex/ssh2/issues/379/events","html_url":"https://github.com/mscdex/ssh2/issues/379","id":123681236,"number":379,"title":"Can not listen to client signal","user":{"login":"mmis1000","id":2993977,"avatar_url":"https://avatars.githubusercontent.com/u/2993977?v=3","gravatar_id":"","url":"https://api.github.com/users/mmis1000","html_url":"https://github.com/mmis1000","followers_url":"https://api.github.com/users/mmis1000/followers","following_url":"https://api.github.com/users/mmis1000/following{/other_user}","gists_url":"https://api.github.com/users/mmis1000/gists{/gist_id}","starred_url":"https://api.github.com/users/mmis1000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmis1000/subscriptions","organizations_url":"https://api.github.com/users/mmis1000/orgs","repos_url":"https://api.github.com/users/mmis1000/repos","events_url":"https://api.github.com/users/mmis1000/events{/privacy}","received_events_url":"https://api.github.com/users/mmis1000/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-23T15:49:52Z","updated_at":"2016-03-05T13:16:35Z","closed_at":null,"body":"```\r\nvar fs = require('fs'),\r\n    crypto = require('crypto'),\r\n    inspect = require('util').inspect;\r\nvar ssh2 = require('ssh2'),\r\n    utils = ssh2.utils;\r\n\r\n\r\nnew ssh2.Server({\r\n  privateKey: fs.readFileSync('keys/id_rsa'),\r\n\t//debug : console.log.bind(console)\r\n}, function(client) {\r\n  console.log('Client connected!');\r\n\r\n  client.on('authentication', function(ctx) {\r\n\t\tif (ctx.username !== 'root') {\r\n\t\t\treturn ctx.reject(['password']);\r\n\t\t} else if (ctx.method !== 'password') {\r\n      return ctx.reject(['password']);\r\n\t\t} else {\r\n\t\t\tctx.accept();\r\n\t\t}\r\n  }).on('ready', function() {\r\n    console.log('Client authenticated!');\r\n\r\n    client.on('session', function(accept, reject) {\r\n\t\t\tconsole.log('Client create session!');\r\n      var session = accept();\r\n      session.once('pty', function(accept, reject, info) {\r\n        rows = info.rows;\r\n        cols = info.cols;\r\n        term = info.term;\r\n        accept && accept();\r\n      });\r\n\t\t\tsession.once('shell', function(accept, reject, info) {\r\n        var stream = accept();\r\n        stream.write('dear cute bee~~\\r\\n');\r\n\t\t\t\t//stream.pipe(stream)\r\n        /*stream.exit(0);\r\n        stream.end();*/\r\n\t\t\t\tstream.on('signal', function(accept, reject, info) {\r\n\t\t\t\t\taccept && accept();\r\n\t\t\t\t\tconsole.log('test', info);\r\n\t\t\t\t});\r\n\t\t\t\t// stream.pipe(stream);\r\n      });\r\n\t\t\tsession.on('signal', function(accept, reject, info) {\r\n        accept && accept();\r\n\t\t\t\tconsole.log('test', info);\r\n      });\r\n    });\r\n  }).on('end', function() {\r\n    console.log('Client disconnected');\r\n  }).on('error', function(err) {\r\n    // ignore errors\r\n  });\r\n}).listen(22, function() {\r\n  console.log('Listening on port ' + this.address().port);\r\n});\r\n```\r\n\r\nI am trying to write a small program with ssh2 server to connect into a docker server\r\nbut i found the 'signal' events does not work at all.\r\nAnd thus make it impossile to quit client when user press ctrl+d.\r\n\r\nIs there some requirement to make the signal events work correctly?\r\n"},"comment":{"url":"https://api.github.com/repos/mscdex/ssh2/issues/comments/192640780","html_url":"https://github.com/mscdex/ssh2/issues/379#issuecomment-192640780","issue_url":"https://api.github.com/repos/mscdex/ssh2/issues/379","id":192640780,"user":{"login":"mscdex","id":54666,"avatar_url":"https://avatars.githubusercontent.com/u/54666?v=3","gravatar_id":"","url":"https://api.github.com/users/mscdex","html_url":"https://github.com/mscdex","followers_url":"https://api.github.com/users/mscdex/followers","following_url":"https://api.github.com/users/mscdex/following{/other_user}","gists_url":"https://api.github.com/users/mscdex/gists{/gist_id}","starred_url":"https://api.github.com/users/mscdex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mscdex/subscriptions","organizations_url":"https://api.github.com/users/mscdex/orgs","repos_url":"https://api.github.com/users/mscdex/repos","events_url":"https://api.github.com/users/mscdex/events{/privacy}","received_events_url":"https://api.github.com/users/mscdex/received_events","type":"User","site_admin":false},"created_at":"2016-03-05T13:16:35Z","updated_at":"2016-03-05T13:16:35Z","body":"Were you able to see a `\\x04` byte in the stream?"}}