提交 793a4818 编写于 作者: L Lukáš Doktor

avocado.core.runner: Disable stdin for tests

We already disable stdin by setting sys.stdin for tests, but there is
still way to access it via `os.read(0, ...)`. This patch replaces the
`0` (STDIN) file descriptor with the `/dev/null` file descriptor.

Simple check is:

    avocado run /bin/read

which hangs until data are provided and fails with this patch.
Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
上级 b2587e35
......@@ -293,6 +293,9 @@ class TestRunner(object):
signal.signal(signal.SIGTERM, sigterm_handler)
# Replace STDIN (0) with the /dev/null's fd
os.dup2(sys.stdin.fileno(), 0)
instance = loader.load_test(test_factory)
if instance.runner_queue is None:
instance.runner_queue = queue
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册