From 223ba43434ef4faad6d199d2e620ece30c278fa9 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Thu, 11 Jul 2019 09:52:25 -0400 Subject: [PATCH] readline: remove IIFE in SIGCONT handler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-By: Luigi Pinca Reviewed-By: Anna Henningsen Reviewed-By: Michaƫl Zasso Reviewed-By: Jeremiah Senkpiel --- lib/readline.js | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/lib/readline.js b/lib/readline.js index 29031e263ed..958370348d5 100644 --- a/lib/readline.js +++ b/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'); }