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: https://github.com/nodejs/node/pull/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>
This commit is contained in:
cjihrig 2019-07-11 09:52:25 -04:00
parent 5af9f15fd8
commit 223ba43434
No known key found for this signature in database
GPG Key ID: 7434390BDBE9B9C5

View File

@ -939,22 +939,20 @@ Interface.prototype._ttyWrite = function(s, key) {
if (this.listenerCount('SIGTSTP') > 0) { if (this.listenerCount('SIGTSTP') > 0) {
this.emit('SIGTSTP'); this.emit('SIGTSTP');
} else { } else {
process.once('SIGCONT', (function continueProcess(self) { process.once('SIGCONT', () => {
return function() { // Don't raise events if stream has already been abandoned.
// Don't raise events if stream has already been abandoned. if (!this.paused) {
if (!self.paused) { // Stream must be paused and resumed after SIGCONT to catch
// Stream must be paused and resumed after SIGCONT to catch // SIGINT, SIGTSTP, and EOF.
// SIGINT, SIGTSTP, and EOF. this.pause();
self.pause(); this.emit('SIGCONT');
self.emit('SIGCONT'); }
} // Explicitly re-enable "raw mode" and move the cursor to
// Explicitly re-enable "raw mode" and move the cursor to // the correct position.
// the correct position. // See https://github.com/joyent/node/issues/3295.
// See https://github.com/joyent/node/issues/3295. this._setRawMode(true);
self._setRawMode(true); this._refreshLine();
self._refreshLine(); });
};
})(this));
this._setRawMode(false); this._setRawMode(false);
process.kill(process.pid, 'SIGTSTP'); process.kill(process.pid, 'SIGTSTP');
} }