File tree 1 file changed +22
-1
lines changed
1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change 67
67
68
68
$setupExe = "$vol\setup.exe"
69
69
$setupFileName = "setup-$platform.exe"
70
- Invoke-WebRequest "https://cygwin.com/$setupFileName" -OutFile $setupExe
70
+
71
+ $maxRetries = 5
72
+ $retryCount = 0
73
+ $success = $false
74
+ $delay = 2
75
+
76
+ while (-not $success -and $retryCount -lt $maxRetries) {
77
+ try {
78
+ Invoke-WebRequest -Uri "https://cygwin.com/$setupFileName" -OutFile $setupExe
79
+ $success = $true
80
+ } catch {
81
+ Write-Output "Attempt $($retryCount + 1) failed. Retrying..."
82
+ Start-Sleep -Seconds $delay
83
+ $retryCount++
84
+ $delay += $delay
85
+ }
86
+ }
87
+
88
+ if (-not $success) {
89
+ throw "Failed to download $setupFileName after $maxRetries attempts."
90
+ }
91
+
71
92
if ((Get-Item -LiteralPath $setupExe).Length -eq 0) {
72
93
throw "The downloaded setup has a zero length!"
73
94
}
You can’t perform that action at this time.
0 commit comments