fix(cli): clean failed tht installer staging

This commit is contained in:
2026-08-15 22:13:24 +02:00
parent a2d5a244de
commit 4fc03574e1
2 changed files with 3 additions and 0 deletions
+1
View File
@@ -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 }
}
+2
View File
@@ -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()