1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-02-26 17:16:01 +02:00

tests: fix false failure in nohup.sh in non tty builds

* tests/misc/nohup.sh: When running tests without a controlling tty,
an exec failure is triggered in a subshell, which causes POSIX
shells to immediately exit the subshell.  This was brought
to notice by the newly conforming bash 4.3.
Fixes http:/bugs.gnu.org/16940
This commit is contained in:
Pádraig Brady
2014-03-05 15:14:07 +00:00
parent 849c1c5b16
commit 5dce6bdfaf

View File

@@ -63,6 +63,11 @@ rm -f nohup.out err
# to stderr must be fatal. Requires stdout to be terminal.
if test -w /dev/full && test -c /dev/full; then
(
# POSIX shells immediately exit the subshell on exec error.
# So check we can write to /dev/tty before the exec, which
# isn't possible if we've no controlling tty for example.
test -c /dev/tty && >/dev/tty || exit 0
exec >/dev/tty
test -t 1 || exit 0
nohup echo hi 2> /dev/full