Skip to content

Fix two spaces in simflags causing silent error #264

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 29, 2025
Merged
Changes from all 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 @@ -320,8 +320,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 @@ -736,7 +737,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 @@ -1114,7 +1115,7 @@ def linearize(self, lintime: Optional[float] = None, simflags: Optional[str] = N
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