xref: /dflybsd-src/tools/regression/bin/sh/execution/killed2.0 (revision 3e3895bf4584c1562faf4533cbd97026ee6a8dcf)
1*3e3895bfSKrzysztof Piecuch# $FreeBSD: head/bin/sh/tests/execution/killed2.0 218105 2011-01-30 22:57:52Z jilles $
23df4d8b0SPeter Avalos# Most shells print a message when a foreground job is killed by a signal.
33df4d8b0SPeter Avalos# POSIX allows this, provided the message is sent to stderr, not stdout.
43df4d8b0SPeter Avalos# Some trickery is needed to capture the message as redirecting stderr of
53df4d8b0SPeter Avalos# the command itself does not affect it. The colon command ensures that
63df4d8b0SPeter Avalos# the subshell forks for ${SH}.
73df4d8b0SPeter Avalos
83df4d8b0SPeter Avalosexec 3>&1
93df4d8b0SPeter Avalosr=`(${SH} -c 'kill $$'; :) 2>&1 >&3`
103df4d8b0SPeter Avalos[ -n "$r" ]
11