Repository navigation
fix: consume stdout concurrently with process exit in auth login - #15058
Merged
Merged
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. 👍 |
thdxr
enabled auto-merge (squash)
February 25, 2026 13:22
thdxr
disabled auto-merge
February 25, 2026 13:22
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
Rwanbt
pushed a commit
to Rwanbt/unifia
that referenced
this pull request
May 5, 2026
AIALRA-0
pushed a commit
to AIALRA-0/opencode-turn-engine
that referenced
this pull request
Jun 10, 2026
Rwanbt
pushed a commit
to Rwanbt/unifia
that referenced
this pull request
Jun 14, 2026
MarsQiu007
referenced
this pull request
in MarsQiu007/openNovel
Jul 31, 2026
meSingh
pushed a commit
to meSingh/opencode
that referenced
this pull request
Sep 6, 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