Skip to content

Commit 4044a40

Browse files
committed
[OMCSessionRunData] define cmd_cwd and use it in OMCProcessLocal
* one windows this defines the local working directory to be used * for docker or WSL this should NOT be set as this directory does NOT exists locally
1 parent d58ff43 commit 4044a40

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

OMPython/ModelicaSystem.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def run_cmd(cmd_run_data: OMCSessionRunData) -> int:
234234
capture_output=True,
235235
text=True,
236236
env=my_env,
237-
cwd=cmd_run_data.cmd_path,
237+
cwd=cmd_run_data.cmd_cwd_local,
238238
timeout=cmd_run_data.cmd_timeout,
239239
check=True,
240240
)

OMPython/OMCSession.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,9 @@ class OMCSessionRunData:
479479
# command timeout
480480
cmd_timeout: Optional[float] = 10.0
481481

482+
# working directory to be used on the *local* system
483+
cmd_cwd_local: Optional[str] = None
484+
482485
def get_cmd(self) -> list[str]:
483486
"""
484487
Get the command line to run the model executable in the environment defined by the OMCProcess definition.
@@ -923,6 +926,8 @@ def omc_run_data_update(self, omc_run_data: OMCSessionRunData, session: OMCSessi
923926
raise OMCSessionException(f"Application file path not found: {cmd_model_executable}")
924927
omc_run_data_copy.cmd_model_executable = cmd_model_executable.as_posix()
925928

929+
omc_run_data_copy.cmd_cwd_local = omc_run_data.cmd_path
930+
926931
return omc_run_data_copy
927932

928933

0 commit comments

Comments
 (0)