From 628b3dc562961a1591159470fe40f12a6700a474 Mon Sep 17 00:00:00 2001 From: Devon Mackay Date: Tue, 10 Jul 2018 10:52:55 -0400 Subject: [PATCH] Modify wrapper to use PGID when terminating app --- script/dev_server_WIP | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/script/dev_server_WIP b/script/dev_server_WIP index 202df4fe..1f5f75a1 100755 --- a/script/dev_server_WIP +++ b/script/dev_server_WIP @@ -8,24 +8,25 @@ source "$(dirname "${0}")"/../script/include/global_header.inc.sh -# Create a function to trap signals with +# Create a function to run after a trap is triggered reap() { - kill -TERM "${child}" + kill -s SIGTERM -- "-$$" sleep 0.1 exit } -# Register trap -trap reap TERM INT +# Register trapping of SIGTERM and SIGINT +trap reap SIGTERM SIGINT + +# Display the script PID, which will also be the process group ID for all +# child processes +echo "Process Group: $$" # Set server launch related environment variables DEBUG=1 LAUNCH_ARGS="$*" + # Launch the app -source ./script/server - -# Capture the PID of the child process -child=$! - -wait $child +source ./script/server & +wait