installer: disable the Restart Manager (#2696)

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Claude <noreply@anthropic.com>
This commit is contained in:
Jan-Otto Kröpke
2026-10-12 00:11:25 +02:00
committed by GitHub
co-authored by Claude
parent b297161773
commit 04d841f11c
2 changed files with 21 additions and 3 deletions
+7
View File
@@ -81,6 +81,13 @@
<Property Id="ARPNOREPAIR" Value="1" />
<Property Id="ARPSIZE" Value="10000" />
<!-- Without this, Windows Installer uses the Restart Manager in silent mode to shut down every
process that holds one of the package's files, before ServiceControl stops the service. It ran
during every upgrade, repair and uninstall, where GitHub-hosted runners intermittently lost
their runner agent. ServiceControl and KillProcess already stop the exporter of this
installation. -->
<Property Id="MSIRESTARTMANAGERCONTROL" Value="Disable" />
<Property Id="START_MENU_FOLDER" Value="0" />
<Property Id="NOSTART" Value="0" />
+14 -3
View File
@@ -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