fix run-web.sh to not leave any process hanging

This commit is contained in:
Guilherme Rugai Freire 2024-03-19 11:47:39 -03:00
parent bf21d05b6d
commit f1190e9892
No known key found for this signature in database
GPG Key ID: AC1D9B6E48E16AC1

View File

@ -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