1#!/bin/sh23test_description='signals work as we expect'4. ./test-lib.sh56cat >expect <<EOF7three8two9one10EOF1112test_expect_success 'sigchain works' '13{ test-sigchain >actual; ret=$?; } &&14case "$ret" in15143) true ;; # POSIX w/ SIGTERM=1516271) true ;; # ksh w/ SIGTERM=15173) true ;; # Windows18*) false ;;19esac &&20test_cmp expect actual21'2223test_expect_success !MINGW 'signals are propagated using shell convention' '24# we use exec here to avoid any sub-shell interpretation25# of the exit code26git config alias.sigterm "!exec test-sigchain" &&27test_expect_code 143 git sigterm28'2930large_git () {31for i in $(test_seq 1 100)32do33git diff --cached --binary || return34done35}3637test_expect_success 'create blob' '38test-genrandom foo 16384 >file &&39git add file40'4142test_expect_success !MINGW 'a constipated git dies with SIGPIPE' '43OUT=$( ((large_git; echo $? 1>&3) | :) 3>&1 ) &&44test "$OUT" -eq 14145'4647test_expect_success !MINGW 'a constipated git dies with SIGPIPE even if parent ignores it' '48OUT=$( ((trap "" PIPE; large_git; echo $? 1>&3) | :) 3>&1 ) &&49test "$OUT" -eq 14150'5152test_done