diff options
author | Alex Xu (Hello71) <alex_y_xu@yahoo.ca> | 2022-04-17 13:27:38 -0400 |
---|---|---|
committer | Alex Xu (Hello71) <alex_y_xu@yahoo.ca> | 2022-04-17 13:27:38 -0400 |
commit | 5551d759c47e60bbff4887fdb556aa4c44a6544a (patch) | |
tree | 1367e43674e8728fa8870f509653e94309cb8e08 | |
parent | f18709d23397cb7673875feafac0d6e50e2a1da6 (diff) | |
download | runescape-launcher-launcher-8cdb2cbe1228c0e3ba7d777a8eb0e7a5a4c6893d.tar.xz runescape-launcher-launcher-8cdb2cbe1228c0e3ba7d777a8eb0e7a5a4c6893d.zip |
see https://www.cons.org/cracauer/sigint.html
-rwxr-xr-x | runescape-launcher-launcher | 12 |
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 |