def __read_process_stream(self, proc, kill_after=None):
timedOut = False
outS = ""
errS = ""
try:
outs, errs = proc.communicate(timeout=kill_after)
outS = outs.decode()
errS = errs.decode()
except subprocess.TimeoutExpired as e:
proc.terminate()
proc.wait()
if e.stdout is not None:
outS = e.stdout.decode()
if e.stderr is not None:
errS = e.stderr.decode()
timedOut = True
logger.debug("%s was terminated", str(" ".join(proc.args)))
return (outS, errS, timedOut)
评论列表
文章目录