Repository navigation
fix(run): add --no-stdin to skip reading piped stdin - #44557
gitRasheed wants to merge 3 commits into
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found related PRs but no duplicates of PR #44557: Related PRs addressing similar stdin/input handling issues:
These are related to stdin/input handling but address different aspects. Your PR #44557 is specifically about adding the No duplicate PRs found |
opencode run reads stdin to EOF whenever fd 0 is not a TTY, before the session starts and even when the prompt was passed as an argument. A harness that holds fd 0 open without EOF (an inherited socket or pipe) blocks the run forever. --no-stdin skips the read; default behavior is unchanged, so piped input still appends to the prompt.
67b445c to
2bd33ea
Compare
Overall: good scoped fix for a genuine operational annoyance — inherited-but-silent fd 0 hanging non-interactive runs — and the
Minor: with |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes #42064
Type of change
What does this PR do?
opencode runreads fd 0 to EOF when stdin is not a TTY (run.ts,await Bun.stdin.text()), even if the prompt is an argument. An inherited socket or pipe that never sends EOF (supervisor, CI runner) hangs the run; prompt length does not matter. The repo's own test harness dodges this by spawning withstdin: "ignore"incli-process.ts.I added a boolean
stdinoption that defaults to true, allowing yargs to provide--no-stdinthrough boolean negation. Piped input still appends to the prompt by default. Declaring"no-stdin"directly does not work because--no-stdinparses asnoStdin=false.How did you verify your code works?
Three subprocess tests in
test/cli/run/no-stdin.test.ts: default piping still appends,--no-stdinexcludes piped data,--no-stdincompletes on a stdin stream with no EOF. The--no-stdintests fail unpatched; suite and typecheck pass.Screenshots / recordings
Not a UI change.
Checklist