Skip to content

Commit 4e01827

Browse files
committed
restore _getuid() - this partly reverts "[OMCProcessDocker*] remove user handling - it was needed for the OMC ZMQ port file ..."
This reverts commit 969cce176ddd20fcdf304712863ccc10af431afd.
1 parent cf0f68d commit 4e01827

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

OMPython/OMCSession.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,15 @@ def _omc_port_get(self) -> str:
680680

681681
return port
682682

683+
@staticmethod
684+
def _getuid() -> int:
685+
"""
686+
The uid to give to docker.
687+
On Windows, volumes are mapped with all files are chmod ugo+rwx,
688+
so uid does not matter as long as it is not the root user.
689+
"""
690+
return 1000 if sys.platform == 'win32' else os.getuid()
691+
683692
def get_server_address(self) -> Optional[str]:
684693
if self._dockerNetwork == "separate" and isinstance(self._dockerCid, str):
685694
output = subprocess.check_output(["docker", "inspect", self._dockerCid]).decode().strip()
@@ -781,6 +790,7 @@ def _docker_omc_cmd(
781790
"docker", "run",
782791
"--cidfile", docker_cid_file.as_posix(),
783792
"--rm",
793+
"--user", str(self._getuid()),
784794
]
785795
+ self._dockerExtraArgs
786796
+ dockerNetworkStr
@@ -887,7 +897,10 @@ def _docker_omc_cmd(self, omc_path_and_args_list) -> list:
887897
if isinstance(self._interactivePort, int):
888898
extraFlags = extraFlags + [f"--interactivePort={int(self._interactivePort)}"]
889899

890-
omc_command = (["docker", "exec"]
900+
omc_command = ([
901+
"docker", "exec",
902+
"--user", str(self._getuid()),
903+
]
891904
+ self._dockerExtraArgs
892905
+ [self._dockerCid, self._dockerOpenModelicaPath]
893906
+ omc_path_and_args_list

0 commit comments

Comments
 (0)