summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Xu (Hello71) <alex_y_xu@yahoo.ca>2022-04-17 13:27:38 -0400
committerAlex Xu (Hello71) <alex_y_xu@yahoo.ca>2022-04-17 13:27:38 -0400
commit5551d759c47e60bbff4887fdb556aa4c44a6544a (patch)
tree1367e43674e8728fa8870f509653e94309cb8e08
parentf18709d23397cb7673875feafac0d6e50e2a1da6 (diff)
downloadrunescape-launcher-launcher-5551d759c47e60bbff4887fdb556aa4c44a6544a.tar.xz
runescape-launcher-launcher-5551d759c47e60bbff4887fdb556aa4c44a6544a.zip
fix signal handlingHEAD1.3master
see https://www.cons.org/cracauer/sigint.html
-rwxr-xr-xrunescape-launcher-launcher12
1 files changed, 10 insertions, 2 deletions
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