Commit 010d858
committed
fix(cli): interrupt running commands cleanly on Ctrl+C
The launcher (bin/cli.js) spawns the real CLI as a child with inherited
stdio. Previously it was torn down by SIGINT before that child finished,
so the child's final status printed after the shell prompt had already
returned (and the child could be left running in the background).
Wait briefly for the child to handle the interrupt itself and mirror its
exit, so output stays ordered. The wait is bounded: if the child outlives
a short grace period, or on a second Ctrl+C, SIGKILL it and exit with the
conventional 128+signum code. The grace timer is unref'd, so a child that
exits on its own is mirrored with no added latency.1 parent c78c6c6 commit 010d858
1 file changed
Lines changed: 30 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
41 | 67 | | |
42 | 68 | | |
43 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
44 | 74 | | |
45 | 75 | | |
46 | 76 | | |
| |||
0 commit comments