Skip to content

Commit 70c3cb7

Browse files
committed
forget it; let's just use curl.exe
curl.exe ships with Windows 10 1803+ (April 2018) and Windows Server 2019+; anyone running a supported version of Windows should have it
1 parent 53dbfe3 commit 70c3cb7

2 files changed

Lines changed: 2 additions & 20 deletions

File tree

tools/install-bin-windows.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ where /q powershell || echo PowerShell not found && exit /b
22

33
cd /d "%TEMP%"
44

5-
powershell -ExecutionPolicy Bypass -Command "Invoke-WebRequest 'https://tinytex.yihui.org/install-bin-windows.ps1' -OutFile 'install-bin-windows.ps1'"
5+
curl.exe -fsSLO 'https://tinytex.yihui.org/install-bin-windows.ps1'
66
powershell -ExecutionPolicy Bypass -File "install-bin-windows.ps1" %*
77
del "install-bin-windows.ps1"

tools/install-bin-windows.ps1

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,5 @@
11
$ErrorActionPreference = 'Stop'
22

3-
function Invoke-DownloadWithRetry {
4-
param([string]$Uri, [string]$OutFile, [int]$MaxRetries = 10, [int]$RetryDelay = 30)
5-
for ($i = 1; $i -le ($MaxRetries + 1); $i++) {
6-
try {
7-
Add-Type -AssemblyName System.Net.Http
8-
$f = [IO.File]::OpenWrite($OutFile)
9-
[Net.Http.HttpClient]::new().GetStreamAsync($Uri).Result.CopyTo($f)
10-
$f.Close()
11-
return
12-
} catch {
13-
Write-Error $_
14-
if ($i -gt $MaxRetries) { throw }
15-
Write-Host "Download failed (attempt $i of $($MaxRetries + 1)), retrying in $RetryDelay seconds..."
16-
Start-Sleep -Seconds $RetryDelay
17-
}
18-
}
19-
}
20-
213
# switch to a temp directory
224
cd $env:TEMP
235
[Environment]::CurrentDirectory = $PWD.Path
@@ -57,7 +39,7 @@ $DownloadedFile = "$TinyTeXFilename.$BundleExt"
5739

5840
# download the bundle
5941
Write-Host "Download $BundleExt file..."
60-
Invoke-DownloadWithRetry $TinyTeXURL $DownloadedFile
42+
curl.exe -fL --retry 10 --retry-delay 30 -o "$DownloadedFile" "$TinyTeXURL"
6143

6244
# unzip the downloaded file
6345
Write-Host 'Unbundle TinyTeX'

0 commit comments

Comments
 (0)