fix: wrap main execution in try/catch to show errors instead of silent exit
This commit is contained in:
@@ -1041,6 +1041,7 @@ function Invoke-Upgrade {
|
|||||||
# ─────────────────────────────────────────
|
# ─────────────────────────────────────────
|
||||||
# 主流程
|
# 主流程
|
||||||
# ─────────────────────────────────────────
|
# ─────────────────────────────────────────
|
||||||
|
try {
|
||||||
"" | Out-File $LOG_FILE
|
"" | Out-File $LOG_FILE
|
||||||
|
|
||||||
# 检测是否是 iex / 管道执行(如 irm | iex)
|
# 检测是否是 iex / 管道执行(如 irm | iex)
|
||||||
@@ -1083,3 +1084,10 @@ if ($isIexExecution) {
|
|||||||
while ($true) {
|
while ($true) {
|
||||||
Main-Menu
|
Main-Menu
|
||||||
}
|
}
|
||||||
|
} catch {
|
||||||
|
Write-Host ""
|
||||||
|
Write-Err "脚本错误: $_"
|
||||||
|
Write-Host "按 Enter 退出..."
|
||||||
|
$null = Read-Host
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user