[PATCH] test: redirect STDIN from /dev/tty
Tomi Ollila
tomi.ollila at iki.fi
Tue May 21 13:17:02 PDT 2019
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).
---
Hopefully this fixes the parallel problems -- In case of moreutils parallel
only stdout and stderr are captured and all other fd's left untouched
(provided I read web namual correctly). With GNU parallel docs did not
help -- but as we pipe $TESTS to parallel in that case things might be
even more complicated there (i don't undersand why but anyway)
test/test-lib.sh | 3 +++
1 file changed, 3 insertions(+)
diff --git a/test/test-lib.sh b/test/test-lib.sh
index ed7f6aa7..068e1029 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:
--
2.21.0
More information about the notmuch
mailing list