Commit 5ca7ca4
Fix example script cleanup to terminate all child processes
The npm run dev command spawns child processes that weren't being
terminated when the parent PID was killed. This fix ensures proper
cleanup by using process groups and port-based killing as fallback.
Changes:
- Kill by process group (negative PID) to terminate child processes
- Add port-based killing via lsof as fallback for remaining processes
- Add INT and TERM signals to the cleanup trap1 parent 82c4cf7 commit 5ca7ca4
1 file changed
Lines changed: 8 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | | - | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | | - | |
| 25 | + | |
25 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
26 | 30 | | |
27 | 31 | | |
28 | 32 | | |
29 | | - | |
| 33 | + | |
30 | 34 | | |
31 | 35 | | |
32 | 36 | | |
| |||
0 commit comments