Skip to content

Commit 58bbac0

Browse files
committed
[OMCProcessWSL] set omc location via argument wsl_omc
1 parent ada825e commit 58bbac0

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

OMPython/OMCSession.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ class OMCProcessWSL(OMCProcess):
979979
def __init__(
980980
self,
981981
timeout: float = 10.00,
982-
omhome: Optional[str] = None,
982+
wsl_omc: str = 'omc',
983983
wsl_distribution: Optional[str] = None,
984984
wsl_user: Optional[str] = None,
985985
) -> None:
@@ -995,7 +995,7 @@ def __init__(
995995
self._wsl_cmd += ['--']
996996

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

1007-
omc_path = 'omc'
1008-
if self._omhome is not None:
1009-
omc_path = f"{self._omhome}/{omc_path}"
1010-
10111007
omc_command = self._wsl_cmd + [
1012-
omc_path,
1008+
self._wsl_omc,
10131009
"--locale=C",
10141010
"--interactive=zmq",
10151011
f"-z={self._random_string}"]
@@ -1030,8 +1026,10 @@ def _omc_port_get(self) -> str:
10301026
try:
10311027
omc_portfile_path = self._get_portfile_path()
10321028
if omc_portfile_path is not None:
1033-
output = subprocess.check_output(args=self._wsl_cmd + ["cat", omc_portfile_path.as_posix()],
1034-
stderr=subprocess.DEVNULL)
1029+
output = subprocess.check_output(
1030+
args=self._wsl_cmd + ["cat", omc_portfile_path.as_posix()],
1031+
stderr=subprocess.DEVNULL,
1032+
)
10351033
port = output.decode().strip()
10361034
except subprocess.CalledProcessError:
10371035
pass

0 commit comments

Comments
 (0)