提交 e51acbfa 编写于 作者: C Cleber Rosa

HTML plugin: use subprocess.DEVNULL instead of custom open file

The HTML plugin is using the `subprocess` library to fire up the
web browser that will show the report.  In theory, we could be
using our own `avocado.utils.process` for that, but given the
comments in that section, I believe there may be caveats.

As a fix for the immediate issue at hand (pylint catching a failure on
a Python 3 environment about using `file`), let's just use the
definitions from the `subprocess` module itself.
Signed-off-by: NCleber Rosa <crosa@redhat.com>
上级 2f368a60
......@@ -222,10 +222,9 @@ class HTMLResult(Result):
setsid = getattr(os, 'setsid', None)
if not setsid:
setsid = getattr(os, 'setpgrp', None)
inout = file(os.devnull, "r+")
cmd = ['xdg-open', html_path]
subprocess.Popen(cmd, close_fds=True, stdin=inout,
stdout=inout, stderr=inout,
subprocess.Popen(cmd, close_fds=True, stdin=subprocess.DEVNULL,
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
preexec_fn=setsid)
def _render(self, result, output_path):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册