1*3e3895bfSKrzysztof Piecuch# $FreeBSD: head/bin/sh/tests/execution/bg11.0 362182 2020-06-14 19:41:24Z jilles $ 2*3e3895bfSKrzysztof Piecuch 3*3e3895bfSKrzysztof PiecuchT=`mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXXXX` 4*3e3895bfSKrzysztof Piecuchtrap 'rm -rf $T' 0 5*3e3895bfSKrzysztof Piecuchcd $T || exit 3 6*3e3895bfSKrzysztof Piecuchmkfifo fifo1 7*3e3895bfSKrzysztof Piecuch# Use a trap, not the default action, since the shell may catch SIGINT and 8*3e3895bfSKrzysztof Piecuch# therefore its processing may be delayed. 9*3e3895bfSKrzysztof Piecuch{ trap 'exit 5' TERM; read dummy <fifo1; exit 4; } & 10*3e3895bfSKrzysztof Piecuchexec 3>fifo1 11*3e3895bfSKrzysztof Piecuchkill -INT "$!" 12*3e3895bfSKrzysztof Piecuchkill -TERM "$!" 13*3e3895bfSKrzysztof Piecuchexec 3>&- 14*3e3895bfSKrzysztof Piecuchwait "$!" 15*3e3895bfSKrzysztof Piecuchr=$? 16*3e3895bfSKrzysztof Piecuch[ "$r" = 5 ] 17