feat: trap more signals

This commit is contained in:
Martin Wimpress 2024-07-23 17:29:55 +01:00 committed by Martin Wimpress
commit cc928c2565

View file

@ -7,7 +7,7 @@ stty -echoctl
readonly STREAM_SPROUT_YAML="stream-sprout.yaml"
readonly VERSION="0.1.4"
function ctrl_c() {
function cleanup() {
echo -e " \e[31m\U26D4\e[0m Control-C"
sleep 0.25
if kill -0 "${FFMPEG_PID}" 2>/dev/null; then
@ -137,8 +137,8 @@ else
exit 1
fi
# trap ctrl-c and call ctrl_c() to clean up
trap ctrl_c INT
# trap relevant signals and call cleanup()
trap cleanup INT QUIT TERM
banner