Skip to content

Commit

Permalink
Handle ctrl+z from readline
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Jun 9, 2010
1 parent adc06dd commit bca16a0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/readline.js
Expand Up @@ -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

Expand Down
12 changes: 12 additions & 0 deletions src/node_stdio.cc
Expand Up @@ -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<v8::Object> target) {
HandleScope scope;
Expand All @@ -199,6 +206,11 @@ void Stdio::Initialize(v8::Handle<v8::Object> 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);
}


Expand Down

0 comments on commit bca16a0

Please sign in to comment.