aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomi Ollila <tomi.ollila@iki.fi>2019-05-21 23:17:02 +0300
committerDavid Bremner <david@tethera.net>2019-05-22 08:47:17 -0300
commitf33053023b2a3f42ba7d87e3ed58b58673bf08ad (patch)
tree0ef1c6bef42cc13fe3da42047c3485afbe2e929e
parent2669117ad75105c475f4c5850d9bf7a79dde9101 (diff)
test: redirect STDIN from /dev/null
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).
-rw-r--r--test/test-lib.sh3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/test-lib.sh b/test/test-lib.sh
index 507886ba..7b49fc97 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -55,6 +55,9 @@ done,*)
;;
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: