Skip to content
Merged
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
34 changes: 23 additions & 11 deletions install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -109,33 +109,45 @@ try {
$maxRetries = 3
$installed = $false
$lastOutput = $null
$lastExitCode = $null
for ($attempt = 1; $attempt -le $maxRetries; $attempt++) {
if ($attempt -eq 1) {
Write-Info "Installing Conductor $tagName…"
} else {
Write-Info "Retrying install (attempt $attempt/$maxRetries)…"
Start-Sleep -Seconds 2
}
$output = $null
try {
$output = & uv tool install --force "git+https://github.com/$Repo.git@$tagName" -c $constraintsFile 2>&1
} catch {
# PowerShell treats native stderr as errors when ErrorActionPreference=Stop
}
$lastOutput = $output
if ($LASTEXITCODE -eq 0) {

# Run uv via temp files so we capture stdout AND stderr regardless of
# PowerShell's $ErrorActionPreference behavior on native stderr.
# Previous approach (`& uv ... 2>&1` inside try/catch with Stop) lost
# the output when PS threw before the assignment completed, leaving
# the user with "(no output captured)" and no way to diagnose.
$stdoutFile = Join-Path $tmpDir "uv-stdout-$attempt.log"
$stderrFile = Join-Path $tmpDir "uv-stderr-$attempt.log"
$proc = Start-Process -FilePath 'uv' `
-ArgumentList @('tool', 'install', '--force', "git+https://github.com/$Repo.git@$tagName", '-c', $constraintsFile) `
-NoNewWindow -Wait -PassThru `
-RedirectStandardOutput $stdoutFile `
-RedirectStandardError $stderrFile

$stdout = if (Test-Path $stdoutFile) { Get-Content $stdoutFile -Raw } else { '' }
$stderr = if (Test-Path $stderrFile) { Get-Content $stderrFile -Raw } else { '' }
$lastOutput = (@($stdout, $stderr) | Where-Object { $_ } | Out-String).Trim()
$lastExitCode = $proc.ExitCode
if ($lastExitCode -eq 0) {
$installed = $true
break
}
}

if (-not $installed) {
Write-Host ""
Write-Host " ── uv tool install output ──" -ForegroundColor Yellow
Write-Host " ── uv tool install output (exit code $lastExitCode) ──" -ForegroundColor Yellow
if ($lastOutput) {
$lastOutput | ForEach-Object { Write-Host " $_" -ForegroundColor DarkGray }
$lastOutput -split "`r?`n" | ForEach-Object { Write-Host " $_" -ForegroundColor DarkGray }
} else {
Write-Host " (no output captured)" -ForegroundColor DarkGray
Write-Host " (no output captured — run 'uv tool install --force `"git+https://github.com/$Repo.git@$tagName`"' manually to see the error)" -ForegroundColor DarkGray
}
Write-Host ""
Write-Info "Install failed after $maxRetries attempts."
Expand Down
Loading