Skip to content

Commit 8519e1c

Browse files
committed
add System.Net.Http
1 parent 4f370a8 commit 8519e1c

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

tools/install-bin-windows.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ function Invoke-DownloadWithRetry {
44
param([string]$Uri, [string]$OutFile, [int]$MaxRetries = 10, [int]$RetryDelay = 30)
55
for ($i = 1; $i -le ($MaxRetries + 1); $i++) {
66
try {
7+
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
8+
Add-Type -AssemblyName System.Net.Http
79
$f = [IO.File]::OpenWrite($OutFile)
810
[Net.Http.HttpClient]::new().GetStreamAsync($Uri).Result.CopyTo($f)
911
$f.Close()
1012
return
1113
} catch {
14+
Write-Error $_
1215
if ($i -gt $MaxRetries) { throw }
1316
Write-Host "Download failed (attempt $i of $($MaxRetries + 1)), retrying in $RetryDelay seconds..."
1417
Start-Sleep -Seconds $RetryDelay

0 commit comments

Comments
 (0)