Skip to content

Commit

Permalink
Revert "readline: clean up event listener in onNewListener"
Browse files Browse the repository at this point in the history
This reverts commit 81ddeb9.

Ref: #13266
PR-URL: #13560
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
addaleax committed Jun 10, 2017
1 parent 53ec50d commit 0df6c0b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
3 changes: 0 additions & 3 deletions lib/readline.js
Original file line number Diff line number Diff line change
Expand Up @@ -1039,9 +1039,6 @@ function emitKeypressEvents(stream, iface) {
} else {
stream.on('newListener', onNewListener);
}
if (iface) {
iface.once('close', () => { stream.removeListener('data', onData); });
}
}

/**
Expand Down
6 changes: 2 additions & 4 deletions test/parallel/test-readline-set-raw-mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ assert(!rawModeCalled);
assert(resumeCalled);
assert(!pauseCalled);

// One data listener for the keypress events.
assert.strictEqual(stream.listeners('data').length, 1);

// close() should call setRawMode(false)
expectedRawMode = false;
Expand All @@ -88,5 +86,5 @@ assert(!resumeCalled);
assert(pauseCalled);

assert.deepStrictEqual(stream.listeners('keypress'), []);
// Data listener is removed once interface is closed.
assert.strictEqual(stream.listeners('data').length, 0);
// one data listener for the keypress events.
assert.strictEqual(stream.listeners('data').length, 1);

0 comments on commit 0df6c0b

Please sign in to comment.