-
Notifications
You must be signed in to change notification settings - Fork 30.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: readline.emitKeypressEvents note #9447
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ rl.question('What do you think of Node.js? ', (answer) => { | |
}); | ||
``` | ||
|
||
*Note* Once this code is invoked, the Node.js application will not | ||
*Note*: Once this code is invoked, the Node.js application will not | ||
terminate until the `readline.Interface` is closed because the interface | ||
waits for data to be received on the `input` stream. | ||
|
||
|
@@ -447,6 +447,10 @@ autocompletion is disabled when copy-pasted input is detected. | |
|
||
If the `stream` is a [TTY][], then it must be in raw mode. | ||
|
||
*Note*: This is automatically called by any readline instance on its `input` | ||
if the `input` is a terminal. Closing the `readline` instance does not stop | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Trott Sounds like a bug to me. function onNewListener(event) {
if (event == 'keypress') {
stream.on('data', onData);
// +++++++++ MISSING +++++++++++
iface.once('close', () => {
stream.removeListener('data', onData);
});
// +++++++++++++++++++++++++++++
stream.removeListener('newListener', onNewListener);
}
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ping @Trott @princejwesley ... any further thoughts on this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure why I I'm being pinged on this (as opposed to anybody else) to be honest... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (Also not sure who a good person to ping about it would be, though. ¯\(ツ)/¯ ) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I think with hindsight we can say @addaleax would be a good person to ping 😉 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well … what I remember about these parts of the code mostly comes from reviewing ae17883, and that was a year ago. I guess at this point we don’t have any real readline experts… |
||
the `input` from emitting `'keypress'` events. | ||
|
||
```js | ||
readline.emitKeypressEvents(process.stdin); | ||
if (process.stdin.isTTY) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note after code snippet ?