From e80c1e1df7bbae3db304c60333fe009267368a5f Mon Sep 17 00:00:00 2001 From: Keith Martin Date: Sun, 24 Aug 2025 20:44:38 +1000 Subject: [PATCH] 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 --- scripts/dist/cmd.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/dist/cmd.sh b/scripts/dist/cmd.sh index 9d2291475..6dd5f8c72 100755 --- a/scripts/dist/cmd.sh +++ b/scripts/dist/cmd.sh @@ -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]+$'