fix(format): restore stdout/stderr ignore for formatter processes#26037
Merged
rekram1-node merged 2 commits intoanomalyco:devfrom May 7, 2026
Merged
fix(format): restore stdout/stderr ignore for formatter processes#26037rekram1-node merged 2 commits intoanomalyco:devfrom
rekram1-node merged 2 commits intoanomalyco:devfrom
Conversation
The ChildProcessSpawner migration in 5cd54ec dropped stdout/stderr: "ignore" when refactoring the formatter to use Effect's spawner. This was an accidental omission. The old Process.spawn defaulted stdout and stderr to "ignore" (not "pipe"): stdio: [opts.stdin ?? "ignore", opts.stdout ?? "ignore", opts.stderr ?? "ignore"] It also resolved on the "exit" event, which fires when the process itself exits. ChildProcessSpawner instead defaults to "pipe" for all stdio and resolves on the "close" event, which only fires after every file descriptor referencing the pipes is closed — including those held by grandchild processes that inherited them. If a formatter like pants spawns worker subprocesses, those children keep the pipe FDs open after the formatter exits. "close" never fires, the Deferred that handle.exitCode awaits is never resolved, and the edit/write tool hangs indefinitely. Restoring stdout/stderr: "ignore" avoids creating pipes entirely, so "close" fires immediately when the formatter process exits regardless of any background children it may have spawned. Fixes: anomalyco#26032
Collaborator
|
/review |
Contributor
|
lgtm |
capyBearista
pushed a commit
to capyBearista/opencode
that referenced
this pull request
May 8, 2026
…omalyco#26037) Co-authored-by: Aiden Cline <[email protected]>
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 #26032
Type of change
What does this PR do?
The ChildProcessSpawner migration in 5cd54ec dropped stdout/stderr: "ignore" when refactoring the formatter to use Effect's spawner. The old Process.spawn defaulted stdout and stderr to "ignore" (not "pipe"):
stdio: [opts.stdin ?? "ignore", opts.stdout ?? "ignore", opts.stderr ?? "ignore"]
It also resolved on the "exit" event, which fires when the process itself exits. ChildProcessSpawner instead defaults to "pipe" for all stdio and resolves on the "close" event, which only fires after every file descriptor referencing the pipes is closed — including those held by grandchild processes that inherited them.
If a formatter like pants spawns worker subprocesses, those children keep the pipe FDs open after the formatter exits. "close" never fires, the Deferred that handle.exitCode awaits is never resolved, and the edit/write tool hangs indefinitely.
Restoring stdout/stderr: "ignore" avoids creating pipes entirely, so "close" fires immediately when the formatter process exits regardless of any background children it may have spawned.
How did you verify your code works?
I've verified manually and also added a test. Manual verification included manually killing the held process in the original version of the code (which is when an edit actually managed to finish instead of hanging) and also verified the new code indeed finishes.
Screenshots / recordings
N/A
Checklist
If you do not follow this template your PR will be automatically rejected.