From 04d841f11c0538e0ed57053d6fd8f8148151aef5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Mon, 12 Oct 2026 00:11:25 +0200 Subject: [PATCH] installer: disable the Restart Manager (#2696) Co-authored-by: Claude Signed-off-by: Claude --- installer/main.wxs | 7 +++++++ tools/test-installer.ps1 | 17 ++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/installer/main.wxs b/installer/main.wxs index b5ca3ba3..df33ce31 100644 --- a/installer/main.wxs +++ b/installer/main.wxs @@ -81,6 +81,13 @@ + + + diff --git a/tools/test-installer.ps1 b/tools/test-installer.ps1 index 4a249aad..1b4dc60b 100644 --- a/tools/test-installer.ps1 +++ b/tools/test-installer.ps1 @@ -76,7 +76,7 @@ function Write-MsiexecDiagnostic([String] $Log, [DateTime] $Since) { } } -function Invoke-Msiexec([String] $Name, [String[]] $Arguments) { +function Invoke-Msiexec([String] $Name, [String[]] $Arguments, [Switch] $PreviousPackage) { $log = Join-Path $WorkDir "$Name.log" $allArguments = $Arguments + @('/qn', '/norestart', '/L*v', "`"$log`"") Write-Host "msiexec $($allArguments -join ' ')" @@ -87,6 +87,17 @@ function Invoke-Msiexec([String] $Name, [String[]] $Arguments) { Write-Host " msiexec $Name took $([Math]::Round(((Get-Date) - $since).TotalSeconds, 1)) s, exit code $($process.ExitCode)" Write-Host " runner after: $(Get-RunnerProcess)" Write-MsiexecDiagnostic -Log $log -Since $since + + # The package disables the Restart Manager, so no operation may shut down + # applications that hold its files. An upgrade removes the previous release + # with the previous package's settings, which still enable it. + if (-not $PreviousPackage -and (Test-Path $log)) { + $shutdown = Select-String -Path $log -Encoding unicode -Pattern 'RESTART MANAGER: Successfully shut down' + if ($null -ne $shutdown) { + throw "msiexec $Name let the Restart Manager shut down applications, see $log" + } + } + # 3010 means success, but a restart is required. if ($process.ExitCode -ne 0 -and $process.ExitCode -ne 3010) { throw "msiexec $Name failed with exit code $($process.ExitCode), see $log" @@ -204,7 +215,7 @@ try { throw "checksum mismatch for $previousMsi`: $actualHash, expected $expectedHash" } - Invoke-Msiexec -Name 'install-previous' -Arguments @('/i', "`"$previousMsi`"") + Invoke-Msiexec -Name 'install-previous' -Arguments @('/i', "`"$previousMsi`"") -PreviousPackage Assert-ServiceRunning | Out-Null Write-Host '::endgroup::' @@ -217,7 +228,7 @@ try { Write-Step 'Upgrade to this build' Start-Foreign - Invoke-Msiexec -Name 'upgrade' -Arguments @('/i', "`"$UpgradeMsi`"") + Invoke-Msiexec -Name 'upgrade' -Arguments @('/i', "`"$UpgradeMsi`"") -PreviousPackage $metrics = Assert-ServiceRunning Assert-InstalledExecutable