Skip to content

fix(interactive): process every stdin line and resolve on EOF - #447

Merged
robgruen merged 3 commits into
microsoft:mainfrom
MohammedAlkindi:fix/interactive-stdin-lines
Oct 30, 2026
Merged

robgruen merged 3 commits into
microsoft:mainfrom
MohammedAlkindi:fix/interactive-stdin-lines

Conversation

@MohammedAlkindi

Copy link
Copy Markdown
Contributor

In stdin mode, processRequests called question() once per request, so input that arrived while a request was running was lost:

  • a line typed or pasted during a request was dropped, and the rest of a multi-line paste too;
  • EOF (Ctrl+D, or the end of a pipe) left the promise pending, or rejected it with readline was closed if 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.ts swaps process.stdin for a stream it controls. All 5 tests fail on main; npm test gives 118 passed on Node 24.18. CI runs only build-all, not npm test.

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.
Resolve the test-script conflict by retaining the failure, file-input, and stdin regression suites.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@robgruen
robgruen merged commit 0d4a56b into microsoft:main Oct 30, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants