Skip to content

Commit da70654

Browse files
peffgitster
authored andcommitted
t: translate SIGINT to an exit
Right now if a test script receives SIGINT (e.g., because a test was hanging and the user hit ^C), 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 SIGINT to make sure we do a clean shutdown, and just chain it to a normal exit (which will trigger any cleanup). Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1165ae6 commit da70654

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

t/test-lib.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ die () {
299299

300300
GIT_EXIT_OK=
301301
trap 'die' EXIT
302+
trap 'exit $?' INT
302303

303304
# The user-facing functions are loaded from a separate file so that
304305
# test_perf subshells can have them too

0 commit comments

Comments
 (0)