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): ...@@ -104,7 +104,12 @@ def exec_fetch_output(cmd, args, timeout=None):
cmd_list = [cmd] cmd_list = [cmd]
cmd_list.extend(args) cmd_list.extend(args)
proc = Popen(cmd_list, stdout=PIPE, stderr=PIPE) proc = Popen(cmd_list, stdout=PIPE, stderr=PIPE)
stdout = ""
stderr = ""
while(True): while(True):
curr_stdout, curr_stderr = proc.communicate()
stdout += curr_stdout
stderr += curr_stderr
if endtime is not None and int(time.time()) >= endtime: if endtime is not None and int(time.time()) >= endtime:
#signal and kill #signal and kill
timeout_trip timeout_trip
...@@ -114,8 +119,12 @@ def exec_fetch_output(cmd, args, timeout=None): ...@@ -114,8 +119,12 @@ def exec_fetch_output(cmd, args, timeout=None):
if proc.poll() is not None: if proc.poll() is not None:
break break
time.sleep(POLL_INT) time.sleep(POLL_INT)
try:
stdout, stderr = proc.communicate() curr_stdout, curr_stderr = proc.communicate()
stdout += curr_stdout
stderr += curr_stderr
except ValueError:
pass # Everything is closed and terminated.
if timeout_trip: if timeout_trip:
raise RuntimeError("%s timed out!" % cmd) raise RuntimeError("%s timed out!" % cmd)
if proc.returncode != 0: 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