fix manifest install

This commit is contained in:
2026-05-15 21:03:55 -04:00
parent d13c505143
commit 4b92de1b38

View File

@@ -141,7 +141,8 @@ foreach ($app in $apps) {
# 执行安装 # 执行安装
try { try {
$proc = Start-Process -FilePath "winget" -ArgumentList $wingetArgs -Wait -PassThru -NoNewWindow & winget @wingetArgs
$exitCode = $LASTEXITCODE
} finally { } finally {
if ($manifestTempDir -and (Test-Path $manifestTempDir)) { if ($manifestTempDir -and (Test-Path $manifestTempDir)) {
Remove-Item -LiteralPath $manifestTempDir -Recurse -Force Remove-Item -LiteralPath $manifestTempDir -Recurse -Force
@@ -149,13 +150,13 @@ foreach ($app in $apps) {
} }
# 检查安装结果 (0=成功, -1978335189=已安装) # 检查安装结果 (0=成功, -1978335189=已安装)
if ($proc.ExitCode -eq 0) { if ($exitCode -eq 0) {
Write-Host "[Success]" -ForegroundColor Green Write-Host "[Success]" -ForegroundColor Green
} elseif ($proc.ExitCode -eq -1978335189) { } elseif ($exitCode -eq -1978335189) {
Write-Host "[Skip] Already installed" -ForegroundColor Yellow Write-Host "[Skip] Already installed" -ForegroundColor Yellow
continue # 已经安装的为了避免覆盖配置,也就不配置了 continue # 已经安装的为了避免覆盖配置,也就不配置了
} else { } else {
Write-Error "[Fail] Error code: $($proc.ExitCode)" Write-Error "[Fail] Error code: $exitCode"
continue # 安装失败则跳过后续配置 continue # 安装失败则跳过后续配置
} }
} }