Skip to content

Commit 40ed004

Browse files
committed
Return to simpler process execution method version
1 parent 3169929 commit 40ed004

File tree

1 file changed

+3
-28
lines changed

1 file changed

+3
-28
lines changed

aqt/installer.py

+3-28
Original file line numberDiff line numberDiff line change
@@ -1591,27 +1591,8 @@ def _get_install_command(self, installer_path: Path) -> list[str]:
15911591
)
15921592
return cmd
15931593

1594-
def _exec_qt_installer(self, arguments: list[str], working_dir: str) -> None:
1595-
"""Execute Qt installer with validated arguments."""
1596-
original_cwd = os.getcwd()
1597-
os.chdir(working_dir)
1598-
try:
1599-
if sys.platform == "win32":
1600-
os.spawnv(os.P_WAIT, "qt-unified-windows-x64-online.exe", ["qt-unified-windows-x64-online.exe"] + arguments)
1601-
else:
1602-
pid = os.fork()
1603-
if pid == 0: # Child process
1604-
if self.os_name == "mac":
1605-
os.execv("qt-unified-macOS-x64-online.dmg", ["qt-unified-macOS-x64-online.dmg"] + arguments)
1606-
elif self.os_name == "linux":
1607-
os.execv("qt-unified-linux-x64-online.run", ["qt-unified-linux-x64-online.run"] + arguments)
1608-
sys.exit(1)
1609-
else: # Parent process
1610-
_, status = os.waitpid(pid, 0)
1611-
if status != 0:
1612-
raise RuntimeError(f"Qt installation failed with status {status}")
1613-
finally:
1614-
os.chdir(original_cwd) # Restore original working directory
1594+
def _exec_qt_installer(self, cmd: list[str], working_dir: str) -> None:
1595+
subprocess.run(cmd, shell=False, check=True, cwd=working_dir)
16151596

16161597
def install(self) -> None:
16171598
if (
@@ -1646,13 +1627,7 @@ def install(self) -> None:
16461627
safe_cmd[email_index + 1] = "********"
16471628
self.logger.info(f"Running: {' '.join(safe_cmd)}")
16481629

1649-
target_path = temp_path / self.ALLOWED_INSTALLERS[self.os_name]
1650-
if installer_path != target_path:
1651-
if target_path.exists():
1652-
target_path.unlink()
1653-
os.symlink(installer_path, target_path)
1654-
1655-
self._exec_qt_installer(cmd[1:], temp_dir)
1630+
self._exec_qt_installer(cmd, temp_dir)
16561631

16571632
except subprocess.CalledProcessError as e:
16581633
self.logger.error(f"Installation failed with exit code {e.returncode}")

0 commit comments

Comments
 (0)