Repository navigation
fix(interactive): process every stdin line and resolve on EOF - #447
Open
Mohammed Alkindi (MohammedAlkindi) wants to merge 1 commit into
Open
Mohammed Alkindi (MohammedAlkindi) wants to merge 1 commit into
Mohammed Alkindi (MohammedAlkindi) wants to merge 1 commit into
Conversation
processRequests asked one question at a time, so lines typed or pasted while a request was running were dropped, and EOF left the promise pending or rejected it. It now iterates the readline interface, which buffers lines and ends on EOF, and prompts only while input is not paused so readline keeps its backpressure.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In stdin mode,
processRequestscalledquestion()once per request, so input that arrived while a request was running was lost:readline was closedif it came mid-request.The Python port already reads every line and stops at EOF. The loop now iterates the readline interface, which buffers lines and ends on EOF. It prompts only while the interface is open and not paused, so readline still stops reading stdin when its line buffer fills.
The file-reading branch is untouched, so this is independent of #435.
The new
test/interactive-stdin.test.tsswapsprocess.stdinfor a stream it controls. All 5 tests fail onmain;npm testgives 118 passed on Node 24.18. CI runs onlybuild-all, notnpm test.