From 9954678c4fea91ffe6e5d006a9ceed6db80b1292 Mon Sep 17 00:00:00 2001 From: sususu Date: Fri, 20 Mar 2026 23:37:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AD=90=E8=84=9A=E6=9C=AC=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=8F=96=E6=B6=88=E5=AE=89=E8=A3=85=E6=97=B6=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E9=9D=9E=E9=9B=B6=E9=80=80=E5=87=BA=E7=A0=81=EF=BC=8C?= =?UTF-8?q?=E9=81=BF=E5=85=8D=E7=88=B6=E8=84=9A=E6=9C=AC=E8=AF=AF=E6=8A=A5?= =?UTF-8?q?=E6=88=90=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 子脚本取消时 exit 0 改为 exit 1,父脚本 Invoke-RemoteSetup 仅依赖 LASTEXITCODE 判断结果(| Out-Host 导致 $? 不可靠)。 --- ClaudeCode/setup-claude-code.ps1 | 2 +- GeminiCLI/setup-gemini.ps1 | 2 +- codex/setup-codex.ps1 | 2 +- setup-claude-code.ps1 | 2 +- setup.ps1 | 5 +++-- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ClaudeCode/setup-claude-code.ps1 b/ClaudeCode/setup-claude-code.ps1 index 0124589..3c35c97 100644 --- a/ClaudeCode/setup-claude-code.ps1 +++ b/ClaudeCode/setup-claude-code.ps1 @@ -469,7 +469,7 @@ function Main { if ($install -eq "n" -or $install -eq "N") { Write-Info "已取消" - exit 0 + exit 1 } if (-not (Install-Tool)) { diff --git a/GeminiCLI/setup-gemini.ps1 b/GeminiCLI/setup-gemini.ps1 index 69f61e9..4e2b6fe 100644 --- a/GeminiCLI/setup-gemini.ps1 +++ b/GeminiCLI/setup-gemini.ps1 @@ -471,7 +471,7 @@ function Main { if ($install -eq "n" -or $install -eq "N") { Write-Info "已取消" - exit 0 + exit 1 } if (-not (Install-Tool)) { diff --git a/codex/setup-codex.ps1 b/codex/setup-codex.ps1 index 4af57f3..fec769c 100644 --- a/codex/setup-codex.ps1 +++ b/codex/setup-codex.ps1 @@ -485,7 +485,7 @@ function Main { if ($install -eq "n" -or $install -eq "N") { Write-Info "已取消" - exit 0 + exit 1 } if (-not (Install-Tool)) { diff --git a/setup-claude-code.ps1 b/setup-claude-code.ps1 index 0b724e1..0fffdff 100644 --- a/setup-claude-code.ps1 +++ b/setup-claude-code.ps1 @@ -468,7 +468,7 @@ function Main { if ($install -eq "n" -or $install -eq "N") { Write-Info "已取消" - exit 0 + exit 1 } if (-not (Install-Tool)) { diff --git a/setup.ps1 b/setup.ps1 index 358acf9..813002e 100644 --- a/setup.ps1 +++ b/setup.ps1 @@ -314,8 +314,9 @@ function Invoke-RemoteSetup { Remove-Item $tempFile -ErrorAction SilentlyContinue # 检查执行结果 - if (-not $scriptSucceeded -or $exitCode -ne 0) { - Write-Error "配置脚本执行失败,退出码: $exitCode" + # 注意: | Out-Host 使 $? 始终为 $true,仅依赖 $LASTEXITCODE + if ($exitCode -ne 0) { + Write-Warning "配置脚本未完成 (退出码: $exitCode)" return $false }