git/t/t0005-signals.sh
Jeff King e828908aa9 t0005: test git exit code from signal death
When a sub-process dies with a signal, we convert the exit
code to the shell convention of 128+sig. Callers of git may
be relying on this behavior, so let's make sure it does not
break.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-02 13:47:54 -07:00

31 lines
577 B
Bash
Executable file

#!/bin/sh
test_description='signals work as we expect'
. ./test-lib.sh
cat >expect <<EOF
three
two
one
EOF
test_expect_success 'sigchain works' '
test-sigchain >actual
case "$?" in
143) true ;; # POSIX w/ SIGTERM=15
271) true ;; # ksh w/ SIGTERM=15
3) true ;; # Windows
*) false ;;
esac &&
test_cmp expect actual
'
test_expect_success 'signals are propagated using shell convention' '
# we use exec here to avoid any sub-shell interpretation
# of the exit code
git config alias.sigterm "!exec test-sigchain" &&
test_expect_code 143 git sigterm
'
test_done