Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions scripts/install.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
$ErrorActionPreference = "Stop"

function Install-Uv {
Invoke-RestMethod -Uri "https://astral.sh/uv/install.ps1" | Invoke-Expression
try {
Invoke-RestMethod -Uri "https://astral.sh/uv/install.ps1" | Invoke-Expression
} catch {
Write-Host ""
Write-Host "ERROR: Failed to download or execute the uv installer." -ForegroundColor Red
Write-Host " $_" -ForegroundColor Red
Write-Host ""
Write-Host "This is usually caused by a restrictive PowerShell execution policy." -ForegroundColor Yellow
Write-Host "To fix this, run the following command first:" -ForegroundColor Yellow
Write-Host ""
Write-Host " Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process" -ForegroundColor Cyan
Write-Host ""
Write-Host "Then re-run the installation command." -ForegroundColor Yellow
Write-Host ""
Write-Host "Press any key to exit..."
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
exit 1
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid exiting the caller's PowerShell session

Checked docs/en/guides/getting-started.md:34-36: the documented Windows install flow pipes this script into Invoke-Expression inside the user's current PowerShell window. In that context, PowerShell's exit closes the current script or PowerShell instance, so this new exit 1 path now tears down the caller's shell on any bootstrap failure instead of returning them to the prompt after printing the remediation. That means users can lose session state/history and can't immediately run the suggested Set-ExecutionPolicy command in the same window.

Useful? React with 👍 / 👎.

}
}

if (Get-Command uv -ErrorAction SilentlyContinue) {
Expand All @@ -12,7 +29,9 @@ if (Get-Command uv -ErrorAction SilentlyContinue) {
}

if (-not (Get-Command $uvBin -ErrorAction SilentlyContinue)) {
Write-Error "Error: uv not found after installation."
Write-Host "Error: uv not found after installation." -ForegroundColor Red
Write-Host "Press any key to exit..."
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
exit 1
}

Expand Down