From 4fc03574e167582d055dfd7c0d171f38dc59a234 Mon Sep 17 00:00:00 2001 From: mptyl Date: Sat, 15 Aug 2026 22:13:24 +0200 Subject: [PATCH] fix(cli): clean failed tht installer staging --- scripts/install-tht.ps1 | 1 + scripts/test-install-tht.ps1 | 2 ++ 2 files changed, 3 insertions(+) diff --git a/scripts/install-tht.ps1 b/scripts/install-tht.ps1 index 9dccece7..8a867a97 100644 --- a/scripts/install-tht.ps1 +++ b/scripts/install-tht.ps1 @@ -122,6 +122,7 @@ try { if ($LASTEXITCODE -ne 0) { throw 'native artifact did not pass its help check' } Replace-InstalledBinary $stagedBinary (Join-Path $installDirectory 'tht.exe') } finally { + Remove-Item -LiteralPath $stagedBinary -Force -ErrorAction SilentlyContinue if ($buildOutput) { Remove-Item -LiteralPath $buildOutput -Recurse -Force -ErrorAction SilentlyContinue } } diff --git a/scripts/test-install-tht.ps1 b/scripts/test-install-tht.ps1 index 9b837006..89d073f1 100644 --- a/scripts/test-install-tht.ps1 +++ b/scripts/test-install-tht.ps1 @@ -63,6 +63,8 @@ public static class ProgramOne { } if (-not $brokenInstallFailed) { throw 'installer accepted an invalid staged executable' } if ((& $installed version) -ne 'tht test version one') { throw 'invalid staged executable replaced the existing command' } + $stagingResidue = @(Get-ChildItem -LiteralPath $installDirectory -Filter '.tht-*.exe' -File) + if ($stagingResidue.Count -ne 0) { throw 'invalid staged executable left temporary installer files behind' } $env:THT_BUILD_ARTIFACT = $artifactTwo $env:THT_BUILD_ARTIFACT_SHA256 = (Get-FileHash -Algorithm SHA256 -LiteralPath $artifactTwo).Hash.ToLowerInvariant()