]> xenbits.xensource.com Git - people/liuw/osstest.git/commitdiff
mg-debug-fail: Catch attempts to read from a tty
authorIan Jackson <ian.jackson@eu.citrix.com>
Fri, 4 Dec 2015 18:41:10 +0000 (18:41 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Tue, 8 Dec 2015 14:51:02 +0000 (14:51 +0000)
When stdin is a tty, do not try to dump it.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
mg-debug-fail

index a163aef4f4e24bb6e4c2ece04abe22a17068f61d..47ad68ab06e0a8f6f998b33b4451de3b62a1f23e 100755 (executable)
@@ -3,10 +3,10 @@
 # This script can be provided anywhere an executable or command name is
 # wanted.  It prints its arguments, and its stdin, to its stderr, and
 # then exits nonzero.
-#
-# When using this it may be useful to provide </dev/null as a
-# redirection for the whole program under test.  Otherwise things
-# can mysteriously hang.
+
+if tty >/dev/null 2>&1; then
+       exec </dev/null
+fi
 
 bash -xc ': mg-debug-fail "$@"' x "$@"
 egrep '' >&2