Commit 6af68b92 authored by Paul Rich's avatar Paul Rich
Browse files

Large output on capmc pipe should no longer cause a hang

Data wasn't getting pulled off the pipe for the capmc subprocess causing
a hang on large systems.
parent 8c14221b
......@@ -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