提交 1c84005c 编写于 作者: L like15

use subprocess.communicate instead of subprocess.wait in tools/python/utils/device.py

上级 9b37c124
......@@ -36,9 +36,11 @@ def execute(cmd, verbose=True):
universal_newlines=True)
if not verbose:
if p.wait() != 0:
raise Exception("\"%s\" with errorcode: %s" % (cmd, p.returncode))
return p.stdout.read()
# use p.communicate instead of p.wait to avoid such situation: pipe is filled and the child process is blocked.
out, err = p.communicate()
if p.returncode != 0:
raise Exception("errorcode: {}".format(p.returncode) )
return out
buf = []
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册