Skip to content

Commit eaf06d8

Browse files
committed
[OMCProcessWSL] set omc location via argument wsl_omc
1 parent 1ec6b2a commit eaf06d8

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

OMPython/OMCSession.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -977,7 +977,7 @@ class OMCProcessWSL(OMCProcess):
977977
def __init__(
978978
self,
979979
timeout: float = 10.00,
980-
omhome: Optional[str] = None,
980+
wsl_omc: str = 'omc',
981981
wsl_distribution: Optional[str] = None,
982982
wsl_user: Optional[str] = None,
983983
) -> None:
@@ -993,7 +993,7 @@ def __init__(
993993
self._wsl_cmd += ['--']
994994

995995
# where to find OpenModelica
996-
self._omhome = omhome
996+
self._wsl_omc = wsl_omc
997997
# start up omc executable, which is waiting for the ZMQ connection
998998
self._omc_process = self._omc_process_get()
999999
# connect to the running omc instance using ZMQ
@@ -1002,12 +1002,8 @@ def __init__(
10021002
def _omc_process_get(self) -> subprocess.Popen:
10031003
my_env = os.environ.copy()
10041004

1005-
omc_path = 'omc'
1006-
if self._omhome is not None:
1007-
omc_path = f"{self._omhome}/{omc_path}"
1008-
10091005
omc_command = self._wsl_cmd + [
1010-
omc_path,
1006+
self._wsl_omc,
10111007
"--locale=C",
10121008
"--interactive=zmq",
10131009
f"-z={self._random_string}"]
@@ -1028,8 +1024,10 @@ def _omc_port_get(self) -> str:
10281024
try:
10291025
omc_portfile_path = self._get_portfile_path()
10301026
if omc_portfile_path is not None:
1031-
output = subprocess.check_output(args=self._wsl_cmd + ["cat", omc_portfile_path.as_posix()],
1032-
stderr=subprocess.DEVNULL)
1027+
output = subprocess.check_output(
1028+
args=self._wsl_cmd + ["cat", omc_portfile_path.as_posix()],
1029+
stderr=subprocess.DEVNULL,
1030+
)
10331031
port = output.decode().strip()
10341032
except subprocess.CalledProcessError:
10351033
pass

0 commit comments

Comments
 (0)