From 4e5da178a39be83ff4bec77d2b3b6d60c6baf871 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Fri, 10 Mar 2023 03:41:14 +0100 Subject: [PATCH] [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 --- tools/bootstrap/node_.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/bootstrap/node_.ps1 b/tools/bootstrap/node_.ps1 index ac8d3b343f1..1107d9542c8 100644 --- a/tools/bootstrap/node_.ps1 +++ b/tools/bootstrap/node_.ps1 @@ -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