Skip to content

Commit fea686b

Browse files
committed
Do not ignore subprocess returncode
Otherwise, it could fail silently (e.g. invalid command line option error is only printed to stdout and not stderr).
1 parent aa8c118 commit fea686b

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

OMPython/ModelicaSystem.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,9 @@ def _run_cmd(self, cmd: list):
230230
raise ModelicaSystemError(f"Error running command {cmd}: {stderr}")
231231
if self._verbose and stdout:
232232
logger.info("OM output for command %s:\n%s", cmd, stdout)
233-
p.wait()
234-
p.terminate()
233+
# check process returncode, some errors don't print to stderr
234+
if p.wait():
235+
raise ModelicaSystemError(f"Error running command {cmd}: nonzero returncode")
235236
except Exception as e:
236237
raise ModelicaSystemError(f"Exception {type(e)} running command {cmd}: {e}")
237238

0 commit comments

Comments
 (0)