1cffe8b812
If job control is not enabled, a background job (... &) ignores SIGINT and SIGQUIT, but this can be reverted using the trap builtin in the same shell environment. Using the set builtin to change options would also revert SIGINT and SIGQUIT to their previous dispositions. This broke due to r317298. Calling setsignal() reverts the effect of ignoresig(). Reported by: bdrewery MFC after: 1 week
17 lines
369 B
Plaintext
17 lines
369 B
Plaintext
# $FreeBSD$
|
|
|
|
T=`mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXXXX`
|
|
trap 'rm -rf $T' 0
|
|
cd $T || exit 3
|
|
mkfifo fifo1
|
|
# Use a trap, not the default action, since the shell may catch SIGINT and
|
|
# therefore its processing may be delayed.
|
|
{ set -C; trap 'exit 5' TERM; read dummy <fifo1; exit 4; } &
|
|
exec 3>fifo1
|
|
kill -INT "$!"
|
|
kill -TERM "$!"
|
|
exec 3>&-
|
|
wait "$!"
|
|
r=$?
|
|
[ "$r" = 5 ]
|