From: Urban Wallasch Date: Thu, 16 Apr 2020 11:09:08 +0000 (+0200) Subject: * Improved trap handling. X-Git-Url: https://git.packet-gain.de/?a=commitdiff_plain;h=86f7912cc3a245e0d492c831d1451157526f704a;p=xbpsui.git * Improved trap handling. --- diff --git a/XbpsUI.sh b/XbpsUI.sh index bf92d92..9ca017a 100755 --- a/XbpsUI.sh +++ b/XbpsUI.sh @@ -63,14 +63,20 @@ fi tmp=$(mktemp -dt xbps-disownedXXXXXX) function cleanup() { + echo "Exiting ($1)." rm -rf $tmp + trap - EXIT + exit } -trap cleanup EXIT -trap cleanup SIGINT -trap cleanup SIGTERM -trap cleanup SIGQUIT -trap cleanup SIGHUP +function trapWithArg() { + func="$1" ; shift + for sig in "$@"; do + trap "$func $sig" "$sig" + done +} + +trapWithArg cleanup EXIT SIGINT SIGTERM SIGQUIT SIGHUP # Create resource file for dialog: