]> git.notmuchmail.org Git - notmuch/commitdiff
test: redirect STDIN from /dev/null
authorTomi Ollila <tomi.ollila@iki.fi>
Tue, 21 May 2019 20:17:02 +0000 (23:17 +0300)
committerDavid Bremner <david@tethera.net>
Wed, 22 May 2019 11:47:17 +0000 (08:47 -0300)
Without this stdin may be anything that parent process provided for it.

Test processes might have tried to read something from it, which would
have caused undeterministic behavior.

E.g. gdb(1) tries to do tty related ioctls on fd 0 (and fd 1 and fd 2,
but those are redirected to 'test.output' before test runs).

test/test-lib.sh

index 507886ba83f97eb69ecad6e6d16693ac505d7cab..7b49fc9799dac7ed371e4214193d74212cfb84da 100644 (file)
@@ -55,6 +55,9 @@ done,*)
        ;;
 esac
 
        ;;
 esac
 
+# STDIN from /dev/null. EOF for readers (and ENOTTY for tty related ioctls).
+exec </dev/null
+
 # Save STDOUT to fd 6 and STDERR to fd 7.
 exec 6>&1 7>&2
 # Make xtrace debugging (when used) use redirected STDERR, with verbose lead:
 # Save STDOUT to fd 6 and STDERR to fd 7.
 exec 6>&1 7>&2
 # Make xtrace debugging (when used) use redirected STDERR, with verbose lead: