WordPress / WordPress/contributor-toolkit
A script whose descendant outlives npm never finishes: the app waits on close while an orphan holds the pipe
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 36
- Forks
- 13
- Avg merge
- 23h 19m
- Merged PRs (30d)
- 72
Description
Description
When a script's process tree is broken from outside (on Windows, closing a console window the Gutenberg build opened, #497), npm exits but a descendant (wp-build) survives holding the stdout pipe. The app marks a script finished on the child's close event, which does not fire while any descendant keeps the pipe open, so the checklist stays on IN PROGRESS, the button stays busy, and the terminal keeps receiving the orphan's output long after npm verbose exit 1. Ctrl+C in the terminal (kill by run id) is the only way out; a contributor does not know that.
Fix idea. Mirror #479 on the natural-exit path: on exit, if close has not followed within a few seconds, force the tree by pid (killTreeByPid) and finish with the exit code npm gave. The orphan's later output is dropped. Same shape for installs and the Playground server.
Step-by-step reproduction instructions
- Windows, Gutenberg site, Run full build.
- Close one of the console windows the build opens (#497).
Expected: the step turns FAILED when npm exits. Actual: IN PROGRESS for as long as the orphan runs (tens of minutes on a slow VM).
Operating system
Windows 11 (UTM VM). The close-vs-exit logic is shared, so a POSIX orphan holding the pipe would do the same.
App version
Trunk at 4c53900 (v1.2.0-beta.1 pass).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the shared close-versus-exit handling described in the issue, including the natural-exit path mirrored from #479. Check how killTreeByPid is used for the main script, installs, and the Playground server. Done means an npm exit marks the step failed promptly, terminates the orphaned tree after the timeout, and drops later output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100