[MIRROR] windows node bootstrapping now downloads node.exe to a separate file before renaming it [MDB IGNORE] (#19508)

* windows node bootstrapping now downloads node.exe to a separate file before renaming it (#73586)

This should stop people from getting "corrupt" copies of node.exe in
their `./tools/bootstrap/.cache` directory. I checked before making this
commit that WebClient.DownloadFile can definitely result in a
half-written file.

* windows node bootstrapping now downloads node.exe to a separate file before renaming it

---------

Co-authored-by: willox <me@wiox.me>
This commit is contained in:
SkyratBot
2023-03-10 02:41:14 +00:00
committed by GitHub
co-authored by willox
parent f9ce50bb89
commit 4e5da178a3
+2 -1
View File
@@ -20,7 +20,8 @@ function Download-Node {
Write-Output "Downloading Node v$NodeVersion (may take a while)"
New-Item $NodeTargetDir -ItemType Directory -ErrorAction silentlyContinue | Out-Null
$WebClient = New-Object Net.WebClient
$WebClient.DownloadFile($NodeSource, $NodeTarget)
$WebClient.DownloadFile($NodeSource, "$NodeTarget.downloading")
Rename-Item "$NodeTarget.downloading" $NodeTarget
}
## Convenience variables