|
34 | 34 | CONDITIONS OF OSMC-PL. |
35 | 35 | """ |
36 | 36 |
|
37 | | -import getpass |
38 | 37 | import io |
39 | 38 | import json |
40 | 39 | import logging |
@@ -446,15 +445,6 @@ def __init__( |
446 | 445 | # generate a random string for this session |
447 | 446 | self._random_string = uuid.uuid4().hex |
448 | 447 |
|
449 | | - # get a user ID |
450 | | - try: |
451 | | - self._currentUser = getpass.getuser() |
452 | | - if not self._currentUser: |
453 | | - self._currentUser = "nobody" |
454 | | - except KeyError: |
455 | | - # We are running as a uid not existing in the password database... Pretend we are nobody |
456 | | - self._currentUser = "nobody" |
457 | | - |
458 | 448 | # omc port and log file |
459 | 449 | self._omc_filebase = f"openmodelica.{self._random_string}" |
460 | 450 |
|
@@ -758,11 +748,12 @@ def _omc_command_docker( |
758 | 748 | if isinstance(self._interactivePort, int): |
759 | 749 | extraFlags = extraFlags + [f"--interactivePort={int(self._interactivePort)}"] |
760 | 750 |
|
761 | | - omc_command = (["docker", "run", |
762 | | - "--cidfile", docker_cid_file.as_posix(), |
763 | | - "--rm", |
764 | | - "--env", f"USER={self._currentUser}", |
765 | | - "--user", str(self._getuid())] |
| 751 | + omc_command = ([ |
| 752 | + "docker", "run", |
| 753 | + "--cidfile", docker_cid_file.as_posix(), |
| 754 | + "--rm", |
| 755 | + "--user", str(self._getuid()), |
| 756 | + ] |
766 | 757 | + self._dockerExtraArgs |
767 | 758 | + dockerNetworkStr |
768 | 759 | + [self._docker, self._dockerOpenModelicaPath] |
@@ -808,7 +799,6 @@ def _omc_port_get(self) -> str: |
808 | 799 |
|
809 | 800 | def _omc_docker_start(self) -> Tuple[subprocess.Popen, DummyPopen, str]: |
810 | 801 | my_env = os.environ.copy() |
811 | | - my_env["USER"] = self._currentUser |
812 | 802 |
|
813 | 803 | docker_cid_file = self._temp_dir / (self._omc_filebase + ".docker.cid") |
814 | 804 |
|
@@ -909,9 +899,10 @@ def _omc_command_docker(self, omc_path_and_args_list) -> list: |
909 | 899 | if isinstance(self._interactivePort, int): |
910 | 900 | extraFlags = extraFlags + [f"--interactivePort={int(self._interactivePort)}"] |
911 | 901 |
|
912 | | - omc_command = (["docker", "exec", |
913 | | - "--env", f"USER={self._currentUser}", |
914 | | - "--user", str(self._getuid())] |
| 902 | + omc_command = ([ |
| 903 | + "docker", "exec", |
| 904 | + "--user", str(self._getuid()), |
| 905 | + ] |
915 | 906 | + self._dockerExtraArgs |
916 | 907 | + [self._dockerCid, self._dockerOpenModelicaPath] |
917 | 908 | + omc_path_and_args_list |
@@ -955,7 +946,6 @@ def _omc_port_get(self) -> str: |
955 | 946 |
|
956 | 947 | def _omc_docker_start(self) -> Tuple[subprocess.Popen, DummyPopen]: |
957 | 948 | my_env = os.environ.copy() |
958 | | - my_env["USER"] = self._currentUser |
959 | 949 |
|
960 | 950 | omc_command = self._omc_command_docker(omc_path_and_args_list=["--locale=C", |
961 | 951 | "--interactive=zmq", |
|
0 commit comments