-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Method pause() on ReadLine should pause 'line' events #8340
Comments
You have used In the documentation they said:
|
Yes, I'm relying on the fact that prompt will resume the input stream. Note that rl.pause is called immediately after each 'line' event, and rl.prompt is only called after the line is entirely processed, even when the processing of the line happens asynchronously. |
Your current code doesn't process the line asynchronously. All of the processing and calling the Try to replace the line that you've called Maybe I didn't get your point.
|
Please try it both ways, synchronously and asynchronously, by changing ./test.js < test.js You'll see the output looks very different between the two runs. The sync Jim On Wed, Sep 10, 2014 at 12:27 PM, Amir Saboury notifications@github.com
|
I ran both sync and async, the results was the same. |
Please clone https://github.com/jimlloyd/node-readline-pause-bug and run make. |
I configured this to run under Travis with both node v0.10 and v0.11. I intentionally constructed the Makefile such that Travis will declare a failed build, due to the bug. See: https://travis-ci.org/jimlloyd/node-readline-pause-bug The Travis job console output shows exactly what I see when I run locally on my MacBook. |
When you call |
Do you expect that if you enter some lines when |
Note that this is a 'line' event, not a 'data' event. The semantics should It seems to me that the semantics of flowing-mode vs non-flowing-mode as in I think you either need to make them work as I expect them to, or you need On Fri, Sep 12, 2014 at 1:03 PM, Amir Saboury notifications@github.com
|
Well, it will probably make more sense to you when you look at those methods differently.
|
But see Mikeal's comment On Fri, Sep 12, 2014 at 10:23 PM, Amir Saboury notifications@github.com
|
@jimlloyd ... is this still an issue for you? |
I've long since worked around this issue, so I have no personal urgency to see it be addressed. But I still believe that it truly is a flaw and in an ideal world resources would be allocated to fix it. Given that this is not an ideal world, I'll leave it up to you as to whether this issue (that supposedly was going to be fixed as far back as 0.9) will ever be fixed. |
@jimlloyd ... will at least mark it as a defer to the converged repo. That will at least keep it on the radar but we'll need someone to step up with a PR to make progress on it. |
+1 |
@jimlloyd what exactly was your work around? |
@silkentrace At the time I filed this issue, my workaround was to use repl-promise. But the full truth is that not long after filing the issue I abandoned the main use case (gremlin-repl) I had for a repl that can be deterministically driven from file input. As such, repl-promise never became a mature package. Let me know if you evaluate repl-promise and decide that it or something like it would serve your needs, as I might be willing to invest some more time into it. |
problem is easily replicated here...
/CODE/ data file:
you will see clearly the output should be 1,2,3,4,5,6... which is not the case so the semantic and the process ARE wrong.. (maybe is not meant for this kind of processing but still would be a really usefull fix) |
This is still jacked up in node 8.5.0.
I agree with @jimlloyd and @ACV2 -- I was thinking about using node's Readline to build some kind of |
This is a duplicate of #3628 which was closed without investigation. I believe the issue is valid and should be fixed, or the documentation should be changed.
See the last comment on #3628 for information on how to reproduce the bug. It's fine with me if you reopen #3628 and then close this issue as a duplicate.
FYI I'd like to be able to pause the input to a REPL, but fixing readline seems to be a prerequisite.
The text was updated successfully, but these errors were encountered: