From 4ff6e8f4118eca64f23f5d1aaa83a00e6b088628 Mon Sep 17 00:00:00 2001 From: ImJeremyHe Date: Thu, 18 Jul 2024 17:53:34 +0800 Subject: [PATCH] Update the script --- scripts/launch-dev-node-with-postgres | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/scripts/launch-dev-node-with-postgres b/scripts/launch-dev-node-with-postgres index 9830a7a677..97156754e9 100644 --- a/scripts/launch-dev-node-with-postgres +++ b/scripts/launch-dev-node-with-postgres @@ -11,22 +11,11 @@ export POSTGRES_PASSWORD=$ESPRESSO_SEQUENCER_POSTGRES_PASSWORD export RUST_LOG=${RUST_LOG:-info} -# Function to handle SIGTERM and SIGINT -cleanup() { - echo "Received SIGTERM or SIGINT. Exiting..." - kill -TERM "$postgres_pid" 2>/dev/null - kill -TERM "$dev_node_pid" 2>/dev/null - wait "$postgres_pid" - wait "$dev_node_pid" - exit 0 -} - -# Trap SIGTERM and SIGINT signals -trap cleanup SIGTERM SIGINT +# Trap SIGTERM and SIGINT signals and send them to the process group +trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT # Start postgres in the background docker-entrypoint.sh postgres & -postgres_pid=$! # Wait (twice) for postgres to be ready # Postgres can be falsely "ready" once before running init scripts. @@ -37,8 +26,4 @@ done # Start the dev node espresso-dev-node & -dev_node_pid=$! - -# Wait for child processes to exit -wait "$postgres_pid" -wait "$dev_node_pid" +wait