mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
readline: ^Z (SIGSTP) handling
Bugfix and update. - Fixed bug where Node's REPL wouldn't continue when returning from ^Z (SIGTSTP) - Removed old readline callback Readline API update with docs. - ^Z (SIGTSTP) is now bypassed on Windows systems. - SIGCONT is now bypassed on Windows systems. - Docs updated to reflect above.
This commit is contained in:
@@ -142,6 +142,8 @@ Example of listening for `SIGINT`:
|
||||
|
||||
`function () {}`
|
||||
|
||||
**This does not work on Windows.**
|
||||
|
||||
Emitted whenever the `in` stream receives a `^Z`, respectively known as
|
||||
`SIGTSTP`. If there is no `SIGTSTP` event listener present when the `in` stream
|
||||
receives a `SIGTSTP`, the program will be sent to the background.
|
||||
@@ -164,6 +166,8 @@ Example of listening for `SIGTSTP`:
|
||||
|
||||
`function () {}`
|
||||
|
||||
**This does not work on Windows.**
|
||||
|
||||
Emitted whenever the `in` stream is sent to the background with `^Z`,
|
||||
respectively known as `SIGTSTP`, and then continued with `fg`. This event only
|
||||
emits if the stream was not paused before sending the program to the
|
||||
|
||||
@@ -531,6 +531,7 @@ Interface.prototype._ttyWrite = function(s, key) {
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
if (process.platform == 'win32') break;
|
||||
if (this.listeners('SIGTSTP').length) {
|
||||
this.emit('SIGTSTP');
|
||||
} else {
|
||||
@@ -547,7 +548,7 @@ Interface.prototype._ttyWrite = function(s, key) {
|
||||
})(this));
|
||||
process.kill(process.pid, 'SIGTSTP');
|
||||
}
|
||||
return;
|
||||
break;
|
||||
|
||||
case 'w': // delete backwards to a word boundary
|
||||
case 'backspace':
|
||||
@@ -568,6 +569,7 @@ Interface.prototype._ttyWrite = function(s, key) {
|
||||
|
||||
case 'right':
|
||||
this._wordRight();
|
||||
break;
|
||||
}
|
||||
|
||||
} else if (key.meta) {
|
||||
|
||||
@@ -153,7 +153,7 @@ function REPLServer(prompt, stream, eval, useGlobal, ignoreUndefined) {
|
||||
self.displayPrompt();
|
||||
});
|
||||
|
||||
rli.addListener('line', function(cmd) {
|
||||
rli.on('line', function(cmd) {
|
||||
sawSIGINT = false;
|
||||
var skipCatchall = false;
|
||||
cmd = trimWhitespace(cmd);
|
||||
@@ -258,8 +258,8 @@ function REPLServer(prompt, stream, eval, useGlobal, ignoreUndefined) {
|
||||
};
|
||||
});
|
||||
|
||||
rli.addListener('close', function() {
|
||||
self.inputStream.destroy();
|
||||
rli.on('SIGCONT', function() {
|
||||
self.displayPrompt();
|
||||
});
|
||||
|
||||
self.displayPrompt();
|
||||
|
||||
Reference in New Issue
Block a user