projects
/
xbpsui.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
55e227e
)
* Improved trap handling.
author
Urban Wallasch
<urban.wallasch@freenet.de>
Thu, 16 Apr 2020 11:09:08 +0000
(13:09 +0200)
committer
Urban Wallasch
<urban.wallasch@freenet.de>
Thu, 16 Apr 2020 11:09:08 +0000
(13:09 +0200)
XbpsUI.sh
patch
|
blob
|
history
diff --git
a/XbpsUI.sh
b/XbpsUI.sh
index bf92d92731ea5ff442864d3154d40f475ee860d2..9ca017a6c45151eecb770a2899523422280bdf18 100755
(executable)
--- 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: