diff options
author | jilles <jilles@FreeBSD.org> | 2013-10-30 21:36:15 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2013-10-30 21:36:15 +0000 |
commit | f49e62a7ebc015c676ff2b04854d9d6f74c24f8e (patch) | |
tree | cf8dba030a6e798646ecaa5e0dc061b40914e39d /tools/regression | |
parent | 8bc610b2eafd68d42bb16ccfbbbb4462233afcf1 (diff) | |
download | FreeBSD-src-f49e62a7ebc015c676ff2b04854d9d6f74c24f8e.zip FreeBSD-src-f49e62a7ebc015c676ff2b04854d9d6f74c24f8e.tar.gz |
sh: Allow trapping SIGINT/SIGQUIT after ignore because of '&'.
If job control is not enabled, background jobs started with ... & ignore
SIGINT and SIGQUIT so that they are not affected by such signals that are
intended for the foreground job. However, this should not prevent
reassigning a different action for these signals (as if the shell invocation
inherited these signal actions from its parent).
Austin group issue #751
Example:
{ trap - INT; exec sleep 10; } & wait
A Ctrl+C should terminate the sleep command.
Diffstat (limited to 'tools/regression')
-rw-r--r-- | tools/regression/bin/sh/builtins/trap13.0 | 8 | ||||
-rw-r--r-- | tools/regression/bin/sh/builtins/trap14.0 | 10 |
2 files changed, 18 insertions, 0 deletions
diff --git a/tools/regression/bin/sh/builtins/trap13.0 b/tools/regression/bin/sh/builtins/trap13.0 new file mode 100644 index 0000000..d90eb08 --- /dev/null +++ b/tools/regression/bin/sh/builtins/trap13.0 @@ -0,0 +1,8 @@ +# $FreeBSD$ + +{ + trap 'exit 0' INT + ${SH} -c 'kill -INT $PPID' + exit 3 +} & +wait $! diff --git a/tools/regression/bin/sh/builtins/trap14.0 b/tools/regression/bin/sh/builtins/trap14.0 new file mode 100644 index 0000000..97cce8d --- /dev/null +++ b/tools/regression/bin/sh/builtins/trap14.0 @@ -0,0 +1,10 @@ +# $FreeBSD$ + +{ + trap - INT + ${SH} -c 'kill -INT $PPID' & + wait +} & +wait $! +r=$? +[ "$r" -gt 128 ] && [ "$(kill -l "$r")" = INT ] |