Skip to content

fix(win32): exit-first plus bounded drain so shell settles on pipe leak - #48427

Closed
2061969365 wants to merge 3 commits into
anomalyco:devfrom
2061969365:fix/win32-close-vs-exit
Closed

2061969365 wants to merge 3 commits into
anomalyco:devfrom
2061969365:fix/win32-close-vs-exit

Conversation

@2061969365

Copy link
Copy Markdown

Fixes #37838. See also #32504, #24784, #29822, #20902.

On Windows, the shell tool waits for pipe EOF (close) instead of process exit, so a grandchild holding an inherited pipe (Start-Process single-side redirect, python sink, adb server, serve_forever) blocks Effect.scoped forever (120s timeout plus 16min hang reported).

  • core/cross-spawn-spawner: resolve exitCode on exit, not close- core/process: exit-first then 2s bounded drain, truncate and settle- opencode/tool/shell: interrupt drain fiber with 500ms grace; auto-complete single-side Start-Process redirect to/null so the parent pwsh can exit

Verified: single-side sink-long goes from 130s timeout to 11s exit 0; typecheck plus core shell tests pass; win32 cloud build green.

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Sep 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

I found 2 potentially related PRs:

  1. fix(core): resolve spawn completion on exit, not only close (Windows detached-child hang) #29831 - fix(core): resolve spawn completion on exit, not only close (Windows detached-child hang)

    • Related: Addresses similar Windows spawn/exit handling issues where child processes hang due to pipe handling
  2. fix: settle shell completion on process exit instead of pipe EOF #44601 - fix: settle shell completion on process exit instead of pipe EOF

    • Related: Directly addresses the same root cause—settling shell completion on process exit rather than waiting for pipe EOF

Both appear to tackle Windows shell/pipe handling issues. PR #44601 in particular seems to address the same fundamental problem of waiting for EOF vs process exit. You may want to check if these were previously attempted solutions or if this PR (#48427) is a more comprehensive fix that supersedes them.

@2061969365 2061969365 closed this Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs:compliance This means the issue will auto-close after 2 hours.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bash tool hangs indefinitely when PowerShell uses Start-Process with -RedirectStandardOutput/-RedirectStandardError on Windows

1 participant