From c58c5639de0c0ec6e92ee25e1138706fd168041f Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Tue, 29 Sep 2015 09:22:51 -0400 Subject: [PATCH] Python API Executor now waits until process has finished before returning from run_simulation(...) routine even if output=False --- openmc/executor.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/openmc/executor.py b/openmc/executor.py index 54c8a64c1a..58cb912465 100644 --- a/openmc/executor.py +++ b/openmc/executor.py @@ -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