Fix MySQL MSI command arguments
This commit is contained in:
@@ -118,6 +118,19 @@ def build_mysql_installer_command(installer_path: Path, log_path: Path) -> list[
|
||||
]
|
||||
|
||||
|
||||
def build_windows_command_parameters(command: list[str]) -> str:
|
||||
parameters: list[str] = []
|
||||
for argument in command[1:]:
|
||||
if argument.startswith("CONSOLEARGS="):
|
||||
value = argument.removeprefix("CONSOLEARGS=")
|
||||
if '"' in value:
|
||||
raise ValueError("MySQL CONSOLEARGS 包含不支持的双引号。")
|
||||
parameters.append(f'CONSOLEARGS="{value}"')
|
||||
else:
|
||||
parameters.append(subprocess.list2cmdline([argument]))
|
||||
return " ".join(parameters)
|
||||
|
||||
|
||||
def default_mysql_install_log_path() -> Path:
|
||||
local_app_data = os.environ.get("LOCALAPPDATA", "").strip()
|
||||
base = Path(local_app_data) if local_app_data else Path.home() / ".autodeploy"
|
||||
@@ -295,7 +308,7 @@ def run_elevated_command(
|
||||
info.fMask = 0x00000040 # SEE_MASK_NOCLOSEPROCESS
|
||||
info.lpVerb = "runas"
|
||||
info.lpFile = command[0]
|
||||
info.lpParameters = subprocess.list2cmdline(command[1:])
|
||||
info.lpParameters = build_windows_command_parameters(command)
|
||||
info.nShow = 1 # SW_SHOWNORMAL: show the Windows Installer progress window.
|
||||
if not shell_execute(ctypes.byref(info)):
|
||||
error_code = ctypes.windll.kernel32.GetLastError()
|
||||
|
||||
Reference in New Issue
Block a user