summaryrefslogtreecommitdiff
path: root/t/test-lib.sh
diff options
context:
space:
mode:
authorSZEDER Gábor <szeder.dev@gmail.com>2018-12-30 19:16:22 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-01-03 22:37:09 (GMT)
commitd45cec4bea4250e7aabb1415ae4d50e0eccaa4b7 (patch)
tree87892bd90e2dd742f19f25497aa68c42ceffb004 /t/test-lib.sh
parent54ea72f09c34eea6646af886b8efb06ddcee5299 (diff)
downloadgit-d45cec4bea4250e7aabb1415ae4d50e0eccaa4b7.zip
git-d45cec4bea4250e7aabb1415ae4d50e0eccaa4b7.tar.gz
git-d45cec4bea4250e7aabb1415ae4d50e0eccaa4b7.tar.bz2
test-lib: translate SIGTERM and SIGHUP to an exit
Right now if a test script receives SIGTERM or SIGHUP (e.g., because a test was hanging and the user 'kill'-ed it or simply closed the terminal window the test was running in), the shell exits immediately. This can be annoying if the test script did any global setup, like starting apache or git-daemon, as it will not have an opportunity to clean up after itself. A subsequent run of the test won't be able to start its own daemon, and will either fail or skip the tests. Instead, let's trap SIGTERM and SIGHUP as well to make sure we do a clean shutdown, and just chain it to a normal exit (which will trigger any cleanup). This patch follows suit of da706545f7 (t: translate SIGINT to an exit, 2015-03-13), and even stole its commit message as well. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/test-lib.sh')
-rw-r--r--t/test-lib.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh
index c34831a..4c3744c 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -476,7 +476,7 @@ die () {
GIT_EXIT_OK=
trap 'die' EXIT
-trap 'exit $?' INT
+trap 'exit $?' INT TERM HUP
# The user-facing functions are loaded from a separate file so that
# test_perf subshells can have them too