Uh oh!
There was an error while loading. Please reload this page.
readline: key interval delay for \r & \n - #8109
Conversation
There was a problem hiding this comment.
Can you drop this style and just wrap this portion of the test in curly braces. That will provide the block scope you want.
Fishrock123
commented
Aug 15, 2016
@princejwesley Could you give an example as to how to induce the problem this fixes?
|
Fishrock123
commented
Aug 15, 2016
This is how I reproduced in macOS. Run the below snippet and hit constreadline=require('readline');constrli=newreadline.Interface({input: process.stdin,output: process.stdout,terminal: true});letcount=0;rli.on('line',function(line){count++;console.log(`line event triggered ${count}`);});Edit: |
jasnell
commented
Aug 15, 2016
It may be better to make the delay period configurable |
mscdex
commented
Aug 15, 2016
I think if we're going to add a delay, it should definitely be configurable (with some sensible default but allowing to opt out altogether -- perhaps with a 0 value). |
princejwesley
commented
Aug 15, 2016
@mscdex Delay is introduced to differentiate whether its a system that emits In nutshell, this PR tries to figure out whether Current experience, ~🙈node>// I hit enter - that emits CR(\r)>// now I hit `ctrl + j ` to emit LF(\n) - no newline |
mscdex
commented
Aug 15, 2016
@princejwesley I understand, but I think it would be useful to be able to explicitly tell |
princejwesley
commented
Aug 15, 2016
@mscdex I'll update the PR with configurable option. Shall I use |
There was a problem hiding this comment.
IMHO this should line up with the input parameter.
mscdex
commented
Aug 15, 2016
@princejwesley I don't really have a preference on the name. Although personally I think if it starts with 'CRLF', that prefix would look better lowercased ( |
b85b036 to
587646aCompareprincejwesley
commented
Aug 16, 2016
There was a problem hiding this comment.
Suggestion: s/exceeds crlfDelay/exceeds crlfDelay milliseconds
There was a problem hiding this comment.
also... should there be a maximum delay? And how does one turn off the delay entirely? In other APIs, we've used setting the value explicitly to 0 or null or Infinity to turn it off.
There was a problem hiding this comment.
I am not sure about the maximum delay but minimum delay should not be zero. the reason is subsequent events(\r followed by \n) may have latency greater than or equal to 1ms. It will obviously break windows system.
What do you suggest ? 10ms as minimum delay?
There was a problem hiding this comment.
I am afraid to put 10ms (seems low because of context switches and other factors). Now I set [100, 2000] as range. It will go few more rounds to come up with better range 😄
princejwesley
commented
Aug 17, 2016
princejwesley
commented
Aug 20, 2016
Another attempt, CI: https://ci.nodejs.org/job/node-test-pull-request/3766/ |
Emit two line events when there is a delay between
CR('\r') and LF('\n')8d1d416 to
3b1b84eCompare| callCount++; | ||
| }); | ||
| fi.emit('data', '\r'); | ||
| setTimeout(() => { |
There was a problem hiding this comment.
Wrap this function with common.mustCall?
yorkie
commented
Aug 24, 2016
LGTM :) |
princejwesley
commented
Aug 26, 2016
princejwesley
commented
Aug 26, 2016
jasnell
commented
Aug 26, 2016
LGTM |
1 similar comment
mscdex
commented
Aug 26, 2016
LGTM |
princejwesley
commented
Aug 28, 2016
Trying again for green build: https://ci.nodejs.org/job/node-test-pull-request/3865/ |
jasnell
commented
Aug 30, 2016
build bot failure on the last CI run... trying one final time for green: https://ci.nodejs.org/job/node-test-pull-request/3897/ |
princejwesley
commented
Aug 31, 2016
@jasnell failed again 😞 |
jasnell
commented
Aug 31, 2016
@nodejs/build @jbergstroem ... can someone take a look to see what's happening with the arm build bot on this? |
ping @nodejs/build |
princejwesley
commented
Sep 5, 2016
@jasnell I see full of red & unstable CI jobs. I'll trigger build after few days to get green build |
jbergstroem
commented
Sep 5, 2016
We've fixed the arm issues; disk-related. Please try again! |
CI: https://ci.nodejs.org/job/node-test-pull-request/3943/ Last CI run: https://ci.nodejs.org/job/node-test-pull-request/3959/ (unstable) |
princejwesley
commented
Sep 8, 2016
@jbergstroem last two build attempts - unstable. can you take a look? |
jbergstroem
commented
Sep 8, 2016
@princejwesley 3959,3960 looked good though! Flaky is fine -- it means a test is known to fail. |
Emit two line events when there is a delay between
CR('\r') and LF('\n').
Introduced a new option `crlfDelay`. If the delay between \r and \n
exceeds `crlfDelay` milliseconds, both \r and \n will be treated as
separate end-of-line input. Default to 100 milliseconds.
`crlfDelay` will be coerced to [100, 2000] range.
PR-URL: #8109
Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>princejwesley
commented
Sep 8, 2016
Landed in a634554 |
Emit two line events when there is a delay between
CR('\r') and LF('\n').
Introduced a new option `crlfDelay`. If the delay between \r and \n
exceeds `crlfDelay` milliseconds, both \r and \n will be treated as
separate end-of-line input. Default to 100 milliseconds.
`crlfDelay` will be coerced to [100, 2000] range.
PR-URL: #8109
Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Checklist
make -j4 test(UNIX), orvcbuild test nosign(Windows) passesAffected core subsystem(s)
readline
Description of change
Emit two line events when there is a delay between
CR('\r') and LF('\n')