install.ps1: 修复 git stderr 被 EAP=Stop 误杀导致的安装中断

This commit is contained in:
leefer
2026-09-27 19:59:58 +08:00
parent 97d8b7ae89
commit 4daa6bdbac
+9 -6
View File
@@ -12,15 +12,18 @@ Say "下载最新代码到 $AppDir ..."
New-Item -ItemType Directory -Force -Path $AppDir | Out-Null
$gotCode = $false
if (Get-Command git -ErrorAction SilentlyContinue) {
# git 会把正常进度写到 stderr,EAP=Stop 会误杀,此段临时放开
$ErrorActionPreference = "Continue"
if (Test-Path (Join-Path $AppDir ".git")) {
git -C $AppDir fetch --all --quiet 2>$null
git -C $AppDir reset --hard origin/main --quiet 2>$null
$gotCode = $?
git -C $AppDir fetch --all --quiet
git -C $AppDir reset --hard origin/main --quiet
if ($LASTEXITCODE -eq 0) { $gotCode = $true }
} else {
git clone --depth 1 "$BaseUrl.git" $AppDir 2>$null
if ($?) { $gotCode = $true }
git clone --depth 1 --quiet "$BaseUrl.git" $AppDir
if ($LASTEXITCODE -eq 0) { $gotCode = $true }
}
if (-not $gotCode -and (Test-Path (Join-Path $AppDir "cli.py"))) { $gotCode = $true }
$ErrorActionPreference = "Stop"
if (-not $gotCode -and (Test-Path (Join-Path $AppDir "main.py"))) { $gotCode = $true }
}
if (-not $gotCode) {
# git 不可用或失败:下载 zip 归档