diff --git a/lib/readline.js b/lib/readline.js index d949e58d444..1f285eb5178 100644 --- a/lib/readline.js +++ b/lib/readline.js @@ -232,6 +232,10 @@ Interface.prototype._ttyWrite = function (b) { this._historyPrev(); break; + case 26: /* ctrl+z */ + process.kill(process.pid, "SIGTSTP"); + return; + case 27: /* escape sequence */ if (b[1] === 98 && this.cursor > 0) { // meta-b - backward word diff --git a/src/node_stdio.cc b/src/node_stdio.cc index 29bd527384f..bfeaff4771e 100644 --- a/src/node_stdio.cc +++ b/src/node_stdio.cc @@ -180,6 +180,13 @@ void Stdio::Flush() { fflush(stderr); } +static void HandleSIGCONT (int signum) { + if (rawmode) { + rawmode = 0; + EnableRawMode(STDIN_FILENO); + } +} + void Stdio::Initialize(v8::Handle target) { HandleScope scope; @@ -199,6 +206,11 @@ void Stdio::Initialize(v8::Handle target) { NODE_SET_METHOD(target, "isStdinBlocking", IsStdinBlocking); NODE_SET_METHOD(target, "setRawMode", SetRawMode); NODE_SET_METHOD(target, "getColumns", GetColumns); + + struct sigaction sa; + bzero(&sa, sizeof(sa)); + sa.sa_handler = HandleSIGCONT; + sigaction(SIGCONT, &sa, NULL); }