fix: add exit event fallback for child process close hang on Windows#24783
Open
bingkxu wants to merge 1 commit intoanomalyco:devfrom
Open
fix: add exit event fallback for child process close hang on Windows#24783bingkxu wants to merge 1 commit intoanomalyco:devfrom
bingkxu wants to merge 1 commit intoanomalyco:devfrom
Conversation
On Windows, when a child process spawns grandchild processes (e.g., build tools like hvigor/Gradle daemons), the grandchild may inherit the stdout/stderr pipe handles. Even after the direct child exits, these inherited handles keep the pipe open, preventing Node.js 'close' event from firing. Since exitCode was resolved only on 'close', this caused bash tool to hang indefinitely in Effect.raceAll waiting for handle.exitCode. Fix: resolve exitCode on 'exit' event with a 2-second fallback. If 'close' fires within 2 seconds (normal case), behavior is unchanged. If 'close' does not fire (daemon holds pipe handle), fallback resolves after 2 seconds. Added test for Windows-specific grandchild holding pipe scenario.
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. 👍 |
3 tasks
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 #24784
Type of change
What does this PR do?
On Windows, when a child process spawns grandchild processes (e.g., build tools like hvigor/Gradle daemons), the grandchild may inherit the stdout/stderr pipe handles. Even after the direct child exits, these inherited handles keep the pipe open, preventing Node.js close event from firing.
The exitCode in cross-spawn-spawner.ts was resolved only on close event, causing bash tool to hang indefinitely in Effect.raceAll waiting for handle.exitCode.
This PR adds a fallback: resolve exitCode on exit event with a 2-second delay. If close fires within 2 seconds (normal case), behavior is unchanged. If close does not fire (daemon holds pipe), fallback resolves after 2 seconds.
How did you verify your code works?
Screenshots / recordings
N/A - This is a backend fix, no UI changes.
Checklist