diff --git a/lib/shell.js b/lib/shell.js index 15aa9fb..d9e5dd6 100644 --- a/lib/shell.js +++ b/lib/shell.js @@ -124,6 +124,12 @@ class ShellClient { } onstdin (data) { + if (data.length === 1 && data[0] === 3) { + this.channel.messages[3].send(0) + this.channel.messages[2].send(Buffer.from('\nCtrl^C\n')) + this.destroy() + return + } this.channel.messages[0].send(data) } @@ -155,6 +161,11 @@ class ShellClient { process.stdin.pause() // + process.exit()? } + destroy () { + this.channel.close() + this.socket.destroy() + } + static parseVariadic (rawArgs) { const index = rawArgs.indexOf('--') const variadic = index === -1 ? null : rawArgs.splice(index + 1)