Skip to content

Report EOF after the prompt input stream ends - #21

Merged
inhere merged 1 commit into
gookit:mainfrom
rupayon123:fix/report-prompt-stream-eof-20261031
Nov 1, 2026
Merged

inhere merged 1 commit into
gookit:mainfrom
rupayon123:fix/report-prompt-stream-eof-20261031

Conversation

@rupayon123

Copy link
Copy Markdown
Contributor

When the prompt scanner reaches clean EOF, it sends an empty answer with a nil error and leaves its channel open. A subsequent Prompt therefore invents a default answer; later calls wait for cancellation even though the input stream has ended.

Close the scanner-owned channel on completion, send only real scanner errors, and return io.EOF when the cached channel is closed. Blank lines still select the configured default, and an unterminated final line is delivered before EOF.

Go1.26.0/macOS arm64 validation:

  • Five EOF regressions fail on the base and pass after the fix.
  • Full suite:257 passing leaf cases across16packages; affected subtree race:110 passing cases across five packages. Vet, build, gofmt, tidy/module locks and Staticcheck pass.
  • A native subprocess with actual piped stdin returns Ada followed by three EOF results; the base invents a fallback and then times out.
  • Supplementary full race testing still fails in unchanged progress.TestMultiProgressAutoRefreshMarksDirty. That same failure is reproduced narrowly on the pristine base; no progress changes or test waiver are included.

The existing scanner token limit, per-reader cache and input ownership remain unchanged. Hosted OS/runtime and terminal-event backends are separate from this stream validation.

@inhere
inhere merged commit 371d92f into gookit:main Nov 1, 2026
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