Signed-off-by: Bert Wesarg <[email protected]>
---
quilt/annotate.in | 2 +-
quilt/header.in | 2 +-
quilt/mail.in | 2 +-
quilt/revert.in | 2 +-
quilt/scripts/inspect.in | 2 +-
quilt/scripts/patchfns.in | 52 ++++++++++++++++++++++++--------------------
quilt/setup.in | 2 +-
7 files changed, 34 insertions(+), 30 deletions(-)
diff --git a/quilt/annotate.in b/quilt/annotate.in
index 0ef21b5..8bf50ef 100644
--- a/quilt/annotate.in
+++ b/quilt/annotate.in
@@ -146,7 +146,7 @@ fi
template=$(gen_tempfile)
-trap "rm -f $template" EXIT
+add_exit_handler "rm -f $template"
# The annotated listing is generated as follows: A file of annotations
# is created based on a file that contains the same number of lines as
diff --git a/quilt/header.in b/quilt/header.in
index 70c48b2..f1a14e4 100644
--- a/quilt/header.in
+++ b/quilt/header.in
@@ -135,7 +135,7 @@ else
tmp=$(gen_tempfile) || exit 1
tmp2=$(gen_tempfile) || exit 1
- trap "rm -f $tmp $tmp2" EXIT
+ add_exit_handler "rm -f $tmp $tmp2"
( if [ -z "$opt_replace" ]
then
diff --git a/quilt/mail.in b/quilt/mail.in
index 1bf5832..a2cf2d5 100644
--- a/quilt/mail.in
+++ b/quilt/mail.in
@@ -396,7 +396,7 @@ fi
total=${#patch...@]}
tmpdir=$(gen_tempfile -d)
-trap "rm -rf $tmpdir" EXIT
+add_exit_handler "rm -rf $tmpdir"
for patch in "${patch...@]}"
do
diff --git a/quilt/revert.in b/quilt/revert.in
index 187a4fa..09096c9 100644
--- a/quilt/revert.in
+++ b/quilt/revert.in
@@ -90,7 +90,7 @@ done
[ $status -eq 0 ] || exit $status
workdir=$(gen_tempfile -d $PWD)
-trap "rm -rf $workdir" EXIT
+add_exit_handler "rm -rf $workdir"
apply_patch_temporarily $workdir $patch "${@/#/$SUBDIR}" || exit 1
for file in ${*/#/$SUBDIR}
diff --git a/quilt/scripts/inspect.in b/quilt/scripts/inspect.in
index 057cbd8..7515084 100644
--- a/quilt/scripts/inspect.in
+++ b/quilt/scripts/inspect.in
@@ -59,7 +59,7 @@ fi
tmpdir="$(gen_tempfile -d ${TMPDIR-/var/tmp}/${0##*/})"
mkdir -p $tmpdir || exit 1
-trap "rm -rf $tmpdir" EXIT
+add_exit_handler "rm -rf $tmpdir"
mkdir -p $tmpdir/build
mkdir -p $tmpdir/bin
diff --git a/quilt/scripts/patchfns.in b/quilt/scripts/patchfns.in
index 9723685..48f0d37 100644
--- a/quilt/scripts/patchfns.in
+++ b/quilt/scripts/patchfns.in
@@ -46,30 +46,34 @@ fi
# ========================================================
-#declare -a exit_handlers
-#
-#add_exit_handler() {
-# exit_handlers[${#exit_handle...@]}]=$1
-#}
-#
-#remove_exit_handler() {
-# declare -a handlers
-# local h
-# for h in "${exit_handle...@]}"; do
-# [ "$h" = "$1" ] && continue
-# handlers[${#handle...@]}]=$h
-# done
-# exit_handlers=( "${handle...@]}" )
-#}
-#
-#run_exit_handlers() {
-# local h
-# for h in "${exit_handle...@]}"; do
-# eval $h
-# done
-#}
-#
-#trap run_exit_handlers EXIT
+declare -a exit_handlers
+
+add_exit_handler() {
+ exit_handlers[${#exit_handle...@]}]=$1
+}
+
+remove_exit_handler()
+{
+ declare -a handlers
+ local h
+ for h in "${exit_handle...@]}"
+ do
+ [ "$h" = "$1" ] && continue
+ handlers[${#handle...@]}]=$h
+ done
+ exit_handlers=( "${handle...@]}" )
+}
+
+run_exit_handlers()
+{
+ local h
+ for h in "${exit_handle...@]}"
+ do
+ eval $h
+ done
+}
+
+trap run_exit_handlers EXIT
# ========================================================
diff --git a/quilt/setup.in b/quilt/setup.in
index 75e7bf9..5db6435 100644
--- a/quilt/setup.in
+++ b/quilt/setup.in
@@ -131,7 +131,7 @@ fi
[ -n "$sourcedir" ] && opt_sourcedir="--sourcedir $sourcedir"
tmpfile=$(gen_tempfile)
-trap "rm -f $tmpfile" EXIT
+add_exit_handler "rm -f $tmpfile"
case "$1" in
*.spec)
--
tg: (4df4797..) bw/exit-handler (depends on: master)
_______________________________________________
Quilt-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/quilt-dev