Docker: Ensure that cmd.sh terminates its child processes when the parent script closes #5172

* Scripts: Ensure that child processes are terminated when parent script closes
* Scripts: Exclude pgrep process id from kill
This commit is contained in:
Keith Martin
2025-08-24 20:44:38 +10:00
committed by GitHub
parent c7e71bbbe2
commit e80c1e1df7

3
scripts/dist/cmd.sh vendored
View File

@@ -1,5 +1,8 @@
#!/usr/bin/env bash
# clean up child processes via trap
trap 'ps -p $$ -o pgid= | xargs pgrep -A -g | xargs kill ;exit' EXIT
# regular expressions
re='^[0-9]+$'