diff --git a/bin/standalone-installer-unix b/bin/standalone-installer-unix index ff56ac0d..22535d74 100755 --- a/bin/standalone-installer-unix +++ b/bin/standalone-installer-unix @@ -45,9 +45,11 @@ main() { pushd "$tmp" >/dev/null log "Temporary working directory: $tmp" + # Timeout and retry for log "Downloading $archive_url" curl "$archive_url" \ --fail --show-error --location --proto "=https" \ + --connect-timeout 15 --retry 3 \ > "$archive" log "Extracting $archive" diff --git a/bin/standalone-installer-windows b/bin/standalone-installer-windows index 77208d97..1e3cb3e1 100755 --- a/bin/standalone-installer-windows +++ b/bin/standalone-installer-windows @@ -58,8 +58,21 @@ function main([string]$version) { # curl is built into PowerShell Core since version 6, but Windows 10 ships # with Windows PowerShell 5. orz + # Retry for + # Invoke-WebRequest has no equivalent to curl's --retry, so use custom retry logic. log "Downloading $archive_url" - Invoke-WebRequest $archive_url -OutFile $archive + $retry = 3 + for ($attempt = 0; ; $attempt++) { + try { + Invoke-WebRequest $archive_url -OutFile $archive + break + } catch { + if ($attempt -ge $retry) { + throw + } + Start-Sleep -Seconds 5 + } + } log "Extracting $archive" New-Item -Type Directory standalone | Out-Null