Repository navigation
Commit 96fa709
committed
fix: prevent process hang on Windows when stdin EOF does not propagate through Volta shim
On Windows with a Volta-managed ccstatusline, spawning ccstatusline as a child
subprocess causes it to hang indefinitely. The process chain is:
parent node -> cmd.exe (shell:true) -> bash (Volta shim) -> volta -> node
The for-await stdin loop never receives EOF because stdin EOF from the parent
does not propagate through cmd.exe -> bash -> volta on Windows. Each Claude Code
statusline refresh spawns a new hung process; in one real session this accumulated
to 961 leaked node.exe processes, 2.1 GB RAM, 90.5% kernel-mode CPU.
Fix 1 (readStdin): replace for-await with event-based reading + 3s bail timeout.
When EOF never arrives, the timeout destroys stdin and resolves the promise.
Data already accumulated in chunks[] is returned normally (no data loss).
Fix 2 (main): add explicit process.exit(0) after renderMultipleLines. Claude Code
abandons (does not kill) statusline processes that run long; an explicit exit
prevents any residual async handles from keeping the event loop alive.
Related: nodejs/node#32291, volta-cli/volta#1199, ccusage/ccusage#4591 parent bed8501 commit 96fa709
1 file changed
Lines changed: 18 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
69 | 75 | | |
70 | | - | |
71 | | - | |
72 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
73 | 83 | | |
74 | 84 | | |
75 | 85 | | |
| |||
327 | 337 | | |
328 | 338 | | |
329 | 339 | | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
330 | 344 | | |
331 | 345 | | |
332 | 346 | | |
| |||
0 commit comments