comment about output capturing

pull/14/head
Min RK 2017-05-24 16:42:25 -07:00
rodzic 698f9e1196
commit e7f0ab645e
1 zmienionych plików z 5 dodań i 0 usunięć

Wyświetl plik

@ -12,11 +12,16 @@ def execute_cmd(cmd, capture=False, **kwargs):
proc = subprocess.Popen(cmd, **kwargs)
if not capture:
# not capturing output, let the subprocesses talk directly to the terminal
ret = proc.wait()
if ret != 0:
raise subprocess.CalledProcessError(ret, cmd)
return
# Capture output for logging.
# Each line will be yielded as text.
# This should behave the same as .readline(), but splits on `\r` OR `\n`,
# not just `\n`.
buf = []
def flush():
line = b''.join(buf).decode('utf8', 'replace')