From 5551d759c47e60bbff4887fdb556aa4c44a6544a Mon Sep 17 00:00:00 2001 From: "Alex Xu (Hello71)" Date: Sun, 17 Apr 2022 13:27:38 -0400 Subject: fix signal handling see https://www.cons.org/cracauer/sigint.html --- runescape-launcher-launcher | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'runescape-launcher-launcher') diff --git a/runescape-launcher-launcher b/runescape-launcher-launcher index 50aff81..bdbe604 100755 --- a/runescape-launcher-launcher +++ b/runescape-launcher-launcher @@ -4,7 +4,15 @@ set -e xdg_data_home=${XDG_DATA_HOME:-$HOME/.local/share} rll=$xdg_data_home/runescape-launcher-launcher tmpdir=$(mktemp -dt runescape-launcher-launcher.XXXXXXXXXX) -trap 'trap "" INT TERM QUIT EXIT; echo "cleaning up temporary directory..." >&2; rm -rf "$tmpdir"' INT TERM QUIT EXIT +cleanup() { + echo "cleaning up temporary directory..." >&2 + rm -rf "$tmpdir" +} +trapped="1 2 3 13 15" +for sig in $trapped; do + trap "trap $trapped; cleanup; kill -$sig $$" $sig +done +trap 'cleanup' EXIT if [ -f "$rll/Packages" ]; then echo "checking for runescape-launcher updates..." else @@ -34,7 +42,7 @@ if ! cmp "$rll/Packages" "$tmpdir/Packages" 2>/dev/null; then else echo "no updates available for runescape-launcher." >&2 fi -trap '' INT TERM QUIT EXIT +trap $trapped rm -rf "$tmpdir" echo "starting runescape-launcher..." >&2 set -x -- cgit v1.2.3-70-g09d2