Skip to content
Permalink
Browse files

readline: remove IIFE in SIGCONT handler

This commit removes an IIFE in the readline SIGCONT handler
that was previously being used to bind `this`.

PR-URL: #28639
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
  • Loading branch information...
cjihrig authored and targos committed Jul 11, 2019
1 parent e0c5e7a commit dc734030fc8c1a0e34dc0ec20a475cb8806e4492
Showing with 14 additions and 16 deletions.
  1. +14 −16 lib/readline.js
@@ -939,22 +939,20 @@ Interface.prototype._ttyWrite = function(s, key) {
if (this.listenerCount('SIGTSTP') > 0) {
this.emit('SIGTSTP');
} else {
process.once('SIGCONT', (function continueProcess(self) {
return function() {
// Don't raise events if stream has already been abandoned.
if (!self.paused) {
// Stream must be paused and resumed after SIGCONT to catch
// SIGINT, SIGTSTP, and EOF.
self.pause();
self.emit('SIGCONT');
}
// Explicitly re-enable "raw mode" and move the cursor to
// the correct position.
// See https://github.com/joyent/node/issues/3295.
self._setRawMode(true);
self._refreshLine();
};
})(this));
process.once('SIGCONT', () => {
// Don't raise events if stream has already been abandoned.
if (!this.paused) {
// Stream must be paused and resumed after SIGCONT to catch
// SIGINT, SIGTSTP, and EOF.
this.pause();
this.emit('SIGCONT');
}
// Explicitly re-enable "raw mode" and move the cursor to
// the correct position.
// See https://github.com/joyent/node/issues/3295.
this._setRawMode(true);
this._refreshLine();
});
this._setRawMode(false);
process.kill(process.pid, 'SIGTSTP');
}

0 comments on commit dc73403

Please sign in to comment.
You can’t perform that action at this time.