Python API Executor now waits until process has finished before returning from run_simulation(...) routine even if output=False

This commit is contained in:
Will Boyd 2015-09-29 09:22:51 -04:00
parent 4451b71f36
commit c58c5639de

View file

@ -30,14 +30,16 @@ class Executor(object):
stdout=subprocess.PIPE)
# Capture and re-print OpenMC output in real-time
while (True and output):
line = p.stdout.readline()
print(line, end='')
while True:
# If OpenMC is finished, break loop
line = p.stdout.readline()
if not line and p.poll() != None:
break
# If user requested output, print to screen
if output:
print(line, end='')
# Return the returncode (integer, zero if no problems encountered)
return p.returncode