fix(install): add network timeouts to install script downloads
The GitHub API and binary download calls in `install_binary()` (`scripts/install.sh`) and `Install-Binary` (`scripts/install.ps1`) could hang indefinitely on stalled connections. Added curl `--connect-timeout`/`--max-time` to the release metadata calls and `--connect-timeout`/`--speed-limit`/`--speed-time` to the binary download, plus `-TimeoutSec` to the PowerShell `Invoke-RestMethod`/`Invoke-WebRequest` calls. Verified `bash -n scripts/install.sh` passes; no TypeScript typecheck is affected. Closes #4253
This commit is contained in:
+3
-3
@@ -239,13 +239,13 @@ function Install-Binary {
|
||||
if ($Ref) {
|
||||
Write-Host "Fetching release $Ref..."
|
||||
try {
|
||||
$Release = Invoke-RestMethod -Uri "https://api.github.com/repos/$Repo/releases/tags/$Ref"
|
||||
$Release = Invoke-RestMethod -Uri "https://api.github.com/repos/$Repo/releases/tags/$Ref" -TimeoutSec 60
|
||||
} catch {
|
||||
throw "Release tag not found: $Ref`nFor branch/commit installs, use -Source with -Ref."
|
||||
}
|
||||
} else {
|
||||
Write-Host "Fetching latest release..."
|
||||
$Release = Invoke-RestMethod -Uri "https://api.github.com/repos/$Repo/releases/latest"
|
||||
$Release = Invoke-RestMethod -Uri "https://api.github.com/repos/$Repo/releases/latest" -TimeoutSec 60
|
||||
}
|
||||
|
||||
$Latest = $Release.tag_name
|
||||
@@ -260,7 +260,7 @@ function Install-Binary {
|
||||
$BinaryUrl = "https://github.com/$Repo/releases/download/$Latest/$BinaryName"
|
||||
Write-Host "Downloading $BinaryName..."
|
||||
$OutPath = Join-Path $InstallDir "omp.exe"
|
||||
Invoke-WebRequest -Uri $BinaryUrl -OutFile $OutPath
|
||||
Invoke-WebRequest -Uri $BinaryUrl -OutFile $OutPath -TimeoutSec 900
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "✓ Installed omp to $OutPath" -ForegroundColor Green
|
||||
|
||||
Reference in New Issue
Block a user