fix: consume stdout concurrently with process exit in auth login#15058
Merged
thdxr merged 1 commit intoanomalyco:devfrom Feb 25, 2026
Merged
fix: consume stdout concurrently with process exit in auth login#15058thdxr merged 1 commit intoanomalyco:devfrom
thdxr merged 1 commit intoanomalyco:devfrom
Conversation
The auth login flow awaited proc.exited before reading proc.stdout, causing the stream to close before consumption. The token was lost, resulting in an empty string stored in auth.json. Read stdout in parallel with proc.exited via Promise.all, matching the pattern already used by Process.run().
Contributor
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
neostfox
pushed a commit
to neostfox/opencode
that referenced
this pull request
Feb 26, 2026
sebishogun
pushed a commit
to sebishogun/opencode
that referenced
this pull request
Feb 26, 2026
jonathanmiddleton
pushed a commit
to jonathanmiddleton/opencode
that referenced
this pull request
Mar 10, 2026
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.
Issue for this PR
Closes #15057
Type of change
What does this PR do?
opencode auth login <url>stores an empty token inauth.jsonbecause the code awaitsproc.exitedbefore starting to readproc.stdout. By the timetext(proc.stdout)runs, the child process has already exited and the OS has closed the pipe — the stream data is lost.The fix reads stdout concurrently with the process exit via
Promise.all, so the stream is actively consumed while the process is still running.How did you verify your code works?
opencode auth login <url>ondev(unfixed) —> confirmedauth.jsonhas"token": ""auth.json, ran again —> confirmed token is now populated with the actual valueScreenshots / recordings
Checklist