From 17deffcfb5cb11992153694beb40d0bfc7a6fd79 Mon Sep 17 00:00:00 2001 From: Christ Date: Thu, 13 Aug 2026 15:28:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20Windows=20=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E5=99=A8=E9=80=80=E5=87=BA=E7=A0=81=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/desktop-cd.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/desktop-cd.yml b/.github/workflows/desktop-cd.yml index 6c4c4ad..b1fa79b 100644 --- a/.github/workflows/desktop-cd.yml +++ b/.github/workflows/desktop-cd.yml @@ -458,8 +458,10 @@ jobs: $installDir = Join-Path $env:ProgramFiles 'Ydisks Xianyu Helper' $uninstaller = Join-Path $installDir 'unins000.exe' try { - & $installer /VERYSILENT /SUPPRESSMSGBOXES /NORESTART "/LOG=$installLog" - $installerExitCode = $LASTEXITCODE + $installerProcess = Start-Process -FilePath $installer ` + -ArgumentList @('/VERYSILENT', '/SUPPRESSMSGBOXES', '/NORESTART', "/LOG=$installLog") ` + -Wait -PassThru + $installerExitCode = $installerProcess.ExitCode if ($installerExitCode -ne 0) { if (Test-Path -LiteralPath $installLog) { Get-Content -LiteralPath $installLog -Tail 200 @@ -518,8 +520,12 @@ jobs: throw } finally { if (Test-Path -LiteralPath $uninstaller -PathType Leaf) { - & $uninstaller /VERYSILENT /SUPPRESSMSGBOXES /NORESTART - if ($LASTEXITCODE -ne 0) { throw "Windows 卸载器执行失败,错误码: $LASTEXITCODE" } + $uninstallerProcess = Start-Process -FilePath $uninstaller ` + -ArgumentList @('/VERYSILENT', '/SUPPRESSMSGBOXES', '/NORESTART') ` + -Wait -PassThru + if ($uninstallerProcess.ExitCode -ne 0) { + throw "Windows 卸载器执行失败,错误码: $($uninstallerProcess.ExitCode)" + } } elseif ($null -ne (Get-CimInstance -ClassName Win32_Service -Filter "Name='$serviceName'" -ErrorAction SilentlyContinue)) { & "$env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe" ` -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass `