From 7f3690db42a7fb8a7cfb1f11bb8b8b22d23ec31f Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Wed, 25 Jul 2012 19:45:31 +0200 Subject: [PATCH] test init: refactor: new function 'am_exit_trap' * t/ax/test-init.sh (am_exit_trap): Here. (trap): Use it instead of inlining the cleanup/finialization code. Signed-off-by: Stefano Lattarini --- t/ax/test-init.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/t/ax/test-init.sh b/t/ax/test-init.sh index d760d6e..47fb1cb 100644 --- a/t/ax/test-init.sh +++ b/t/ax/test-init.sh @@ -899,7 +899,9 @@ process_requirements $required distdir=$me-1.0 # Set up the exit trap. -trap 'exit_status=$? +am_exit_trap () +{ + exit_status=$1 set +e cd "$am_top_builddir" if test $am_using_tap = yes; then @@ -929,7 +931,9 @@ trap 'exit_status=$? echo "$me: exit $exit_status" # Spurious escaping to ensure we do not call our "exit" alias. \exit $exit_status -' 0 +} + +trap 'am_exit_trap $?' 0 trap "fatal_ 'caught signal SIGHUP'" 1 trap "fatal_ 'caught signal SIGINT'" 2 trap "fatal_ 'caught signal SIGTERM'" 15 -- 2.7.4