File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 3838# Setup
3939# ------------------------------------------------------------
4040
41- SU2_RUN = os .environ ["SU2_RUN" ]
41+ try :
42+ SU2_RUN = os .environ ["SU2_RUN" ]
43+ except KeyError as exc :
44+ raise RuntimeError (
45+ 'Environment variable "SU2_RUN" is not set. Please set SU2_RUN to the SU2 installation bin directory.'
46+ ) from exc
47+
4248sys .path .append (SU2_RUN )
4349quote = '"' if sys .platform == "win32" else ""
4450
@@ -263,14 +269,17 @@ def run_command(Command):
263269 """
264270 sys .stdout .flush ()
265271
272+ # Avoid potential deadlocks when a child process writes heavily to stderr:
273+ # read stderr via communicate() while streaming stdout to the console.
266274 # Use communicate() to continuously drain stderr and avoid deadlocks if the
267275 # subprocess writes a lot of output to stderr.
268276 proc = subprocess .Popen (
269277 Command , shell = True , stdout = sys .stdout , stderr = subprocess .PIPE
270278 )
271279 _ , stderr = proc .communicate ()
280+
272281 return_code = proc .returncode
273- message = stderr .decode (errors = "replace" )
282+ message = ( stderr or b"" ) .decode (errors = "replace" )
274283
275284 if return_code < 0 :
276285 message = "SU2 process was terminated by signal '%s'\n %s" % (
You can’t perform that action at this time.
0 commit comments