From 1980c8e12aaebd272b88499cb5def549fe5ff38d Mon Sep 17 00:00:00 2001 From: Dylan Conway Date: Thu, 12 Feb 2026 16:43:56 -0800 Subject: [PATCH] Fix 7zip install: use try/catch for post_install cleanup error [build images] --- scripts/bootstrap.ps1 | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/bootstrap.ps1 b/scripts/bootstrap.ps1 index 188a3f0c7f..087e8a9195 100755 --- a/scripts/bootstrap.ps1 +++ b/scripts/bootstrap.ps1 @@ -231,10 +231,16 @@ function Install-Ruby { function Install-7zip { # Scoop 7zip post_install tries to clean up 7zr.exe in TEMP which can fail # with access denied when running as SYSTEM. This is non-fatal. - $prevPref = $ErrorActionPreference - $ErrorActionPreference = "Continue" - Install-Scoop-Package 7zip -Command 7z - $ErrorActionPreference = $prevPref + try { + Install-Scoop-Package 7zip -Command 7z + } catch { + # Check if 7z is actually installed despite the error + if (Which 7z) { + Write-Output "7zip installed (ignoring post_install cleanup error)" + } else { + throw $_ + } + } } function Install-Make {