Skip to content

fix(core): add exit fallback for child process close hangs - #28336

Closed
hgylyq wants to merge 1 commit into
anomalyco:devfrom
hgylyq:fix/windows-childprocess-close-hang-fallback
Closed

hgylyq wants to merge 1 commit into
anomalyco:devfrom
hgylyq:fix/windows-childprocess-close-hang-fallback

Conversation

@hgylyq

@hgylyq hgylyq commented May 19, 2026

Copy link
Copy Markdown

Summary

  • add a minimal exit-event fallback in packages/core/src/cross-spawn-spawner.ts
  • keep the current close-first behavior in the normal case
  • add a Windows regression test for grandchild stdout handle inheritance

Why

Commands such as Gradle / dotnet / hvigor can finish successfully while a daemon or grandchild process still holds inherited stdout/stderr handles open. In that case Node's close event may be delayed indefinitely even though exit has already fired, which leaves shell/task execution stuck waiting for handle.exitCode.

This patch keeps existing behavior when close arrives promptly, but falls back to the cached exit result after 2 seconds when close never arrives.

Related

Testing

  • Added a Windows-only regression test for the grandchild-pipe scenario
  • Local �un is not available in this environment, so I could not run �un typecheck / package tests here

@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels May 19, 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

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

Copy link
Copy Markdown
Contributor

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

Found potentially related PRs:

  1. fix: add exit event fallback for child process close hang on Windows #26147 - "fix: add exit event fallback for child process close hang on Windows"

    • This appears to be directly related as it addresses the same issue (exit event fallback for close hangs) on Windows
  2. fix: prevent pkill hang when close event never firesFix/pkill hang #25672 - "fix: prevent pkill hang when close event never fires"

    • This addresses a related issue where the close event never fires, causing hangs with pkill

Both PRs address similar root causes related to child processes not firing close events properly. #26147 in particular seems to be a very similar fix to the current PR #28336. You may want to check if #26147 was previously closed/merged and if this is a reopened or updated version of that fix.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label May 19, 2026
@github-actions github-actions Bot closed this May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant