From e1b8217e45fb6e1637faf7cbaea6505b59b6bdf4 Mon Sep 17 00:00:00 2001 From: viettranx Date: Fri, 27 Mar 2026 23:37:06 +0700 Subject: [PATCH] fix(desktop): keep PowerShell window open on install errors Add Exit-WithPause helper that waits for keypress before closing the window, so users can read error messages when fetch/download fails. --- scripts/install-lite.ps1 | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/scripts/install-lite.ps1 b/scripts/install-lite.ps1 index 08c898d6..18535ecb 100644 --- a/scripts/install-lite.ps1 +++ b/scripts/install-lite.ps1 @@ -8,6 +8,14 @@ param([string]$Version = "") $ErrorActionPreference = "Stop" $ProgressPreference = "SilentlyContinue" # Speeds up Invoke-WebRequest significantly + +function Exit-WithPause { + param([int]$Code = 0) + Write-Host "" + Write-Host "Press any key to exit..." -ForegroundColor Gray + try { $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") } catch { Start-Sleep -Seconds 5 } + exit $Code +} $Repo = "nextlevelbuilder/goclaw" $InstallDir = Join-Path $env:LOCALAPPDATA "GoClaw Lite" @@ -19,13 +27,13 @@ if (-not $Version) { } catch { Write-Host "Failed to fetch releases: $_" -ForegroundColor Red Write-Host "Check: https://github.com/$Repo/releases" -ForegroundColor Yellow - exit 1 + Exit-WithPause 1 } $latest = $releases | Where-Object { $_.tag_name -like "lite-v*" -and -not $_.prerelease -and -not $_.draft } | Select-Object -First 1 if (-not $latest) { Write-Host "No desktop release found." -ForegroundColor Red Write-Host "Check: https://github.com/$Repo/releases" -ForegroundColor Yellow - exit 1 + Exit-WithPause 1 } $Version = $latest.tag_name } @@ -44,7 +52,7 @@ try { } catch { Write-Host "Download failed: $_" -ForegroundColor Red Write-Host "URL: $Url" -ForegroundColor Yellow - exit 1 + Exit-WithPause 1 } # ── Extract ── @@ -77,3 +85,4 @@ Write-Host " Location: $InstallDir" -ForegroundColor Gray Write-Host "" Write-Host "-> Launching GoClaw Lite..." if (Test-Path $ExePath) { Start-Process $ExePath } +Exit-WithPause 0