Commit 49c7581a authored by Paul Rich's avatar Paul Rich
Browse files

Merge branch '78-fix-memory-control-large-system' into 'develop'

Large output on capmc pipe should no longer cause a hang

Closes #78

See merge request !40
parents 8c14221b 6af68b92
......@@ -104,7 +104,12 @@ def exec_fetch_output(cmd, args, timeout=None):
cmd_list = [cmd]
cmd_list.extend(args)
proc = Popen(cmd_list, stdout=PIPE, stderr=PIPE)
stdout = ""
stderr = ""
while(True):
curr_stdout, curr_stderr = proc.communicate()
stdout += curr_stdout
stderr += curr_stderr
if endtime is not None and int(time.time()) >= endtime:
#signal and kill
timeout_trip
......@@ -114,8 +119,12 @@ def exec_fetch_output(cmd, args, timeout=None):
if proc.poll() is not None:
break
time.sleep(POLL_INT)
stdout, stderr = proc.communicate()
try:
curr_stdout, curr_stderr = proc.communicate()
stdout += curr_stdout
stderr += curr_stderr
except ValueError:
pass # Everything is closed and terminated.
if timeout_trip:
raise RuntimeError("%s timed out!" % cmd)
if proc.returncode != 0:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment