Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.3k
add escapeCodeTimeout as an option to createInterface#19780
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
Trott commented Apr 3, 2018
Hi, @raoofha and welcome! Thanks for the pull request! Some immediate thoughts:
/ping @thlorenz |
addaleax commented Apr 3, 2018
Would it make sense to do this on a per-instance basis, rather than for each Node.js process as a whole? |
lib/readline.js Outdated
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.
If we're going to do this, passing escapeCodeTimeout as an option to readline.createInterface() would seem to be the better approach.
raoofha commented Apr 4, 2018 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
I add doc ( copyed from here ) and manually test it on my machine. I don't know how to write test for it, if you can tell me how maybe I can do it. thanks |
Trott commented Apr 4, 2018
Sorry @raoofha, I should have included this link with my comment! https://github.com/nodejs/node/blob/master/doc/guides/writing-tests.md Hope it helps. (And if it doesn't, maybe you can give some feedback and we can try to improve it!) |
raoofha commented Apr 4, 2018
thanks @Trott for your comments. I added a simple test and waiting for your review. |
Trott commented Apr 4, 2018
I rebased to get rid of the conflict, and also reworded the documentation. (Hope that's OK!) |
Trott commented Apr 4, 2018
CI failures are unrelated. Re-running relevant jobs. Re-run FreeBSD: https://ci.nodejs.org/job/node-test-commit-freebsd/16720/ |
lib/readline.js Outdated
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.
Suggestion: the check could be moved in the upper if.
lib/readline.js Outdated
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.
Suggestion: just write:
timeoutId=setTimeout(escapeCodeTimeoutFn,iface ? iface.escapeCodeTimeout : ESCAPE_CODE_TIMEOUT);doc/api/readline.md Outdated
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.
It is unclear in what unit the time is measured here. It should say something like The duration readline will wait for a character when reading an ambiguous key sequence in milliseconds (...).
I personally would also only accept integers but that is just me.
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.
These tests are doing all the same thing and are just duplicated. It would be best to write:
[null,{},NaN,'50'].forEach((invalidInput)=>{constfi=newFakeInput();constrli=newreadline.Interface({input: fi,output: fi,escapeCodeTimeout: invalidInput});assert.strictEqual(rli.escapeCodeTimeout,ESCAPE_CODE_TIMEOUT);rli.close();});
cjihrig left a comment
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.
Left a few comments. Mostly trying to make the diff less noisy.
doc/api/readline.md Outdated
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.
The parentheses should probably go next to "ambiguous key sequence"
lib/readline.js Outdated
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.
Perhaps Number.isFinite() should be used here. It's also probably better to throw, rather than silently use a different value.
lib/readline.js Outdated
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.
Could you remove this new blank line.
lib/readline.js Outdated
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.
escapeCodeTimeout isn't used between here and line 101. I don't think you need to create an intermediate variable for it.
lib/readline.js Outdated
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.
And if you don't introduce a new intermediate variable, you don't need to rename this.
BridgeAR commented May 15, 2018
@raoofha if you have some time, would you be so kind and have a look at the comments? :-) |
raoofha commented May 15, 2018
@BridgeAR sorry, I will |
raoofha commented May 15, 2018
lib/readline.js Outdated
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.
This should be moved into the added upper if statement, since it is only necessary to test to possible provided option. If non was passed through, we already know that the value is finite.
raoofha commented May 16, 2018
@BridgeAR please take a look again |
raoofha commented Jul 12, 2018
hi @BridgeAR wondering when this is going to merge, or is there something that I have to do first? |
maclover7 commented Aug 11, 2018
CI: https://ci.nodejs.org/job/node-test-pull-request/16372/ @BridgeAR I believe your comments have been addressed, PTAL |
jasnell commented Sep 10, 2018
Ping @BridgeAR |
lundibundi commented Oct 15, 2018 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Changes LGTM but I'm not familiar with realine, hence no green mark. ping @BridgeAR. |
BridgeAR left a comment
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.
LGTM
BridgeAR commented Oct 16, 2018
Just as note: this did not have to wait on me. I did not block anything. |
refack commented Oct 16, 2018
escapeCodeTimeout option in createInterface default to ESCAPE_CODE_TIMEOUT = 500 when set to a NaN or negative number or a value other than a number set back to default value
refack commented Oct 16, 2018
Had to rebase in order to get a proper CI: https://ci.nodejs.org/job/node-test-pull-request/17910/ |
Trott commented Oct 18, 2018
Resume Build: https://ci.nodejs.org/job/node-test-pull-request/17960/ |
PR-URL: #19780 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
jasnell commented Oct 25, 2018
Landed in c829202 |
PR-URL: #19780 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
PR-URL: #19780 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
PR-URL: #19780 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Signed-off-by: Beth Griggs <[email protected]>
500ms for application like readline-vim is very annoying. this PR allow the developer to control the timeout.
make -j4 test(UNIX), orvcbuild test(Windows) passes