Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions OMPython/ModelicaSystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,9 @@ def _run_cmd(self, cmd: list):
raise ModelicaSystemError(f"Error running command {cmd}: {stderr}")
if self._verbose and stdout:
logger.info("OM output for command %s:\n%s", cmd, stdout)
p.wait()
p.terminate()
# check process returncode, some errors don't print to stderr
if p.wait():
raise ModelicaSystemError(f"Error running command {cmd}: nonzero returncode")
except Exception as e:
raise ModelicaSystemError(f"Exception {type(e)} running command {cmd}: {e}")

Expand Down Expand Up @@ -589,7 +590,7 @@ def simulate(self, resultfile=None, simflags=None): # 11
raise Exception(f"Error: Application file path not found: {exe_file}")

cmd = exe_file.as_posix() + override + csvinput + r + simflags
cmd = cmd.split(" ")
cmd = [s for s in cmd.split(' ') if s]
self._run_cmd(cmd=cmd)
self.simulationFlag = True

Expand Down Expand Up @@ -1018,7 +1019,7 @@ def linearize(self, lintime=None, simflags=None): # 22
raise Exception(f"Error: Application file path not found: {exe_file}")
else:
cmd = exe_file.as_posix() + linruntime + override + csvinput + simflags
cmd = cmd.split(' ')
cmd = [s for s in cmd.split(' ') if s]
self._run_cmd(cmd=cmd)

# code to get the matrix and linear inputs, outputs and states
Expand Down
Loading