From f1190e989261d01a31b07d533e8baa4d7b4b07db Mon Sep 17 00:00:00 2001 From: Guilherme Rugai Freire Date: Tue, 19 Mar 2024 11:47:39 -0300 Subject: [PATCH] fix run-web.sh to not leave any process hanging --- run-web.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/run-web.sh b/run-web.sh index cf88466..96a2c65 100755 --- a/run-web.sh +++ b/run-web.sh @@ -15,7 +15,11 @@ run_server() { ts="$(get_ts)" run_server -trap "kill -s KILL $pid; trap - EXIT; exit" EXIT INT HUP +k() { + kill -s KILL $pid +} + +trap "k; trap - EXIT; exit 0" EXIT INT HUP while true; do sleep 1; @@ -24,7 +28,7 @@ while true; do ts="$new_ts" echo "" if [ "$pid" != "0" ]; then - kill -s KILL $pid + k fi run_server fi