summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBert Wesarg <bert.wesarg@googlemail.com>2009-11-18 23:30:10 +0100
committerAndreas Gruenbacher <agruen@suse.de>2009-11-20 22:55:22 +0100
commit393c487db5e08d0176666c288303597cf8a2d65d (patch)
tree1325bb08abfa94d2931b5719d68d69d8d2b39a5f
parentbc8f635dac379a9f830edd2922abec1fef3d4b99 (diff)
downloadquilt-393c487db5e08d0176666c288303597cf8a2d65d.tar.gz
re-activate exit handler multiplexer
Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
-rw-r--r--quilt/annotate.in2
-rw-r--r--quilt/header.in2
-rw-r--r--quilt/mail.in2
-rw-r--r--quilt/revert.in2
-rw-r--r--quilt/scripts/inspect.in2
-rw-r--r--quilt/scripts/patchfns.in52
-rw-r--r--quilt/setup.in2
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=${#patches[@]}
tmpdir=$(gen_tempfile -d)
-trap "rm -rf $tmpdir" EXIT
+add_exit_handler "rm -rf $tmpdir"
for patch in "${patches[@]}"
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 e3657c6..ac631bd 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 395df30..c2946bc 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_handlers[@]}]=$1
-#}
-#
-#remove_exit_handler() {
-# declare -a handlers
-# local h
-# for h in "${exit_handlers[@]}"; do
-# [ "$h" = "$1" ] && continue
-# handlers[${#handlers[@]}]=$h
-# done
-# exit_handlers=( "${handlers[@]}" )
-#}
-#
-#run_exit_handlers() {
-# local h
-# for h in "${exit_handlers[@]}"; do
-# eval $h
-# done
-#}
-#
-#trap run_exit_handlers EXIT
+declare -a exit_handlers
+
+add_exit_handler() {
+ exit_handlers[${#exit_handlers[@]}]=$1
+}
+
+remove_exit_handler()
+{
+ declare -a handlers
+ local h
+ for h in "${exit_handlers[@]}"
+ do
+ [ "$h" = "$1" ] && continue
+ handlers[${#handlers[@]}]=$h
+ done
+ exit_handlers=( "${handlers[@]}" )
+}
+
+run_exit_handlers()
+{
+ local h
+ for h in "${exit_handlers[@]}"
+ 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)