Skip to content

Commit 7e2858b

Browse files
authored
Merge pull request #53 from alex-feel/alex-feel-dev
Prevent PowerShell terminal from closing when using iex
2 parents 5099bfa + 32316e7 commit 7e2858b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

scripts/windows/setup-environment.ps1

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ if (-not $uvPath) {
4141
Write-Host "[FAIL] Failed to install uv: $_" -ForegroundColor Red
4242
Write-Host ""
4343
Write-Host "Please install uv manually from: https://docs.astral.sh/uv/" -ForegroundColor Yellow
44-
exit 1
44+
throw "uv installation failed"
4545
}
4646
} else {
4747
Write-Host "[OK] uv is already installed" -ForegroundColor Green
@@ -69,7 +69,7 @@ try {
6969
Write-Host "Available configurations:" -ForegroundColor Cyan
7070
Write-Host " - python : Python development environment" -ForegroundColor Gray
7171
Write-Host ""
72-
exit 1
72+
throw "No configuration specified"
7373
}
7474

7575
Write-Host "[INFO] Using configuration: $config" -ForegroundColor Yellow
@@ -81,8 +81,12 @@ try {
8181
# Clean up
8282
Remove-Item $tempScript -Force -ErrorAction SilentlyContinue
8383

84-
exit $exitCode
84+
# Don't use exit when running with iex to avoid closing the terminal
85+
if ($exitCode -ne 0) {
86+
throw "Setup failed with exit code $exitCode"
87+
}
88+
return
8589
} catch {
8690
Write-Host "[FAIL] Failed to run setup: $_" -ForegroundColor Red
87-
exit 1
91+
throw "Setup failed: $_"
8892
}

0 commit comments

Comments
 (0)