Fix: pause on error instead of closing PowerShell window
Replace exit 1 with Read-Host + return so users can read the error message before the window closes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,7 @@ $ErrorActionPreference = "Stop"
|
|||||||
function Write-Info($msg) { Write-Host "[信息] $msg" -ForegroundColor Cyan }
|
function Write-Info($msg) { Write-Host "[信息] $msg" -ForegroundColor Cyan }
|
||||||
function Write-Ok($msg) { Write-Host "[完成] $msg" -ForegroundColor Green }
|
function Write-Ok($msg) { Write-Host "[完成] $msg" -ForegroundColor Green }
|
||||||
function Write-Warn($msg) { Write-Host "[警告] $msg" -ForegroundColor Yellow }
|
function Write-Warn($msg) { Write-Host "[警告] $msg" -ForegroundColor Yellow }
|
||||||
function Write-Err($msg) { Write-Host "[错误] $msg" -ForegroundColor Red; exit 1 }
|
function Write-Err($msg) { Write-Host "[错误] $msg" -ForegroundColor Red; Read-Host "按 Enter 键退出"; return }
|
||||||
|
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-Host "========================================" -ForegroundColor White
|
Write-Host "========================================" -ForegroundColor White
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ $ErrorActionPreference = "Stop"
|
|||||||
function Write-Info($msg) { Write-Host "[INFO] $msg" -ForegroundColor Cyan }
|
function Write-Info($msg) { Write-Host "[INFO] $msg" -ForegroundColor Cyan }
|
||||||
function Write-Ok($msg) { Write-Host "[DONE] $msg" -ForegroundColor Green }
|
function Write-Ok($msg) { Write-Host "[DONE] $msg" -ForegroundColor Green }
|
||||||
function Write-Warn($msg) { Write-Host "[WARN] $msg" -ForegroundColor Yellow }
|
function Write-Warn($msg) { Write-Host "[WARN] $msg" -ForegroundColor Yellow }
|
||||||
function Write-Err($msg) { Write-Host "[ERROR] $msg" -ForegroundColor Red; exit 1 }
|
function Write-Err($msg) { Write-Host "[ERROR] $msg" -ForegroundColor Red; Read-Host "Press Enter to exit"; return }
|
||||||
|
|
||||||
function Write-Header {
|
function Write-Header {
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ $ErrorActionPreference = "Stop"
|
|||||||
function Write-Info($msg) { Write-Host "[信息] $msg" -ForegroundColor Cyan }
|
function Write-Info($msg) { Write-Host "[信息] $msg" -ForegroundColor Cyan }
|
||||||
function Write-Ok($msg) { Write-Host "[完成] $msg" -ForegroundColor Green }
|
function Write-Ok($msg) { Write-Host "[完成] $msg" -ForegroundColor Green }
|
||||||
function Write-Warn($msg) { Write-Host "[警告] $msg" -ForegroundColor Yellow }
|
function Write-Warn($msg) { Write-Host "[警告] $msg" -ForegroundColor Yellow }
|
||||||
function Write-Err($msg) { Write-Host "[错误] $msg" -ForegroundColor Red; exit 1 }
|
function Write-Err($msg) { Write-Host "[错误] $msg" -ForegroundColor Red; Read-Host "按 Enter 键退出"; return }
|
||||||
|
|
||||||
function Write-Header {
|
function Write-Header {
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
|
|||||||
Reference in New Issue
Block a user