From 4e4e08b375ed676aa062e597dbd3efb031f42784 Mon Sep 17 00:00:00 2001 From: cflmy Date: Thu, 3 Dec 2026 17:49:26 +0800 Subject: [PATCH] fix(mqdh): bound every Windows installer smoke step with a timeout (#33) The NSIS silent install can wait forever on a CI runner if it falls back to an interactive UI. Use Start-Process + WaitForExit with explicit timeouts for install, version, backend smoke and uninstall so the job fails fast with a real diagnostic instead of hanging. --- scripts/tauri/build-windows.ps1 | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/scripts/tauri/build-windows.ps1 b/scripts/tauri/build-windows.ps1 index 6994872d84..edb2fa27df 100644 --- a/scripts/tauri/build-windows.ps1 +++ b/scripts/tauri/build-windows.ps1 @@ -23,12 +23,22 @@ New-Item -ItemType Directory -Force .ci | Out-Null $final = ".ci/mqdh-$version-windows-x86_64-setup.exe" Copy-Item $setup.FullName $final node scripts/tauri/collect-installer.mjs --installer $final nsis x86_64-pc-windows-msvc -& $final /S +Write-Output "build-windows: silent install" +$install = Start-Process -FilePath $final -ArgumentList '/S' -PassThru +if (-not $install.WaitForExit(180000)) { $install.Kill(); throw 'NSIS silent install timed out' } $installed = Join-Path $env:LOCALAPPDATA 'MQDH\MQDH.exe' if (-not (Test-Path $installed)) { throw "per-user NSIS install not found: $installed" } -& $installed --version +$version = Start-Process -FilePath $installed -ArgumentList '--version' -PassThru -NoNewWindow +if (-not $version.WaitForExit(60000)) { $version.Kill(); throw 'installed --version timed out' } +Write-Output "build-windows: installed version command passed" $home = Join-Path $env:TEMP ("mqdh-smoke-" + [guid]::NewGuid()) $env:MQDH_HOME = $home -& $installed --smoke -if (Test-Path $installed) { & (Join-Path $env:LOCALAPPDATA 'MQDH\uninstall.exe') /S } +$smoke = Start-Process -FilePath $installed -ArgumentList '--smoke' -PassThru -NoNewWindow +if (-not $smoke.WaitForExit(300000)) { $smoke.Kill(); throw 'installed backend --smoke timed out' } +if ($smoke.ExitCode -ne 0) { throw "installed backend --smoke failed: $($smoke.ExitCode)" } +$uninstall = Join-Path (Split-Path $installed) 'uninstall.exe' +if (Test-Path $uninstall) { + $remove = Start-Process -FilePath $uninstall -ArgumentList '/S' -PassThru + if (-not $remove.WaitForExit(120000)) { $remove.Kill(); throw 'NSIS uninstall timed out' } +} Write-Output "build-windows: OK $final"