From 2c73fdee45ccdef5f9861b15cb821e9ba0816e3a Mon Sep 17 00:00:00 2001 From: Manu Date: Wed, 25 Nov 2020 14:29:58 +0100 Subject: [PATCH] fix launcher script terminating before child terminates on SIGTERM --- internal/node/launcher.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/node/launcher.sh b/internal/node/launcher.sh index de6ea0094c..a4eceb77a1 100644 --- a/internal/node/launcher.sh +++ b/internal/node/launcher.sh @@ -332,6 +332,12 @@ readonly child=$! trap _term SIGTERM trap _int SIGINT wait "${child}" +# Remove trap after first signal has been receieved and wait for child to exit +# (first wait returns immediatel if SIGTERM is received while waiting). Second +# wait is a no-op if child has already terminated. +trap - SIGTERM SIGINT +wait "${child}" + RESULT="$?" set -e