implement new Download-FileDirectly function to handle downloads
This commit is contained in:
+2
-2
@@ -53,9 +53,9 @@ $DsaExecutablePath = Join-Path -Path $Global:ToolsDirectory -ChildPath 'dsa-coll
|
||||
New-Item -Path $Global:ToolsDirectory -ItemType Directory -Force -ErrorAction Stop | Out-Null
|
||||
|
||||
Write-Output "Downloading dsa-collect.exe to ${DsaExecutablePath}"
|
||||
$DsaDownloadedFile = Download-File -URL $DsaDownloadUrl -File $DsaExecutablePath -ErrorAction Stop
|
||||
$DsaDownloadedFile = Download-FileDirectly -URL $DsaDownloadUrl -File $DsaExecutablePath -ErrorAction Stop
|
||||
|
||||
# Download-File can return nothing on failure. Do not run a stale executable.
|
||||
# Require a returned path and a nonempty download before starting the collector.
|
||||
If ( [string]::IsNullOrWhiteSpace([string]$DsaDownloadedFile) -or
|
||||
!(Test-Path -LiteralPath $DsaExecutablePath -PathType Leaf) ) {
|
||||
Throw "Failed to download dsa-collect.exe to ${DsaExecutablePath}"
|
||||
|
||||
Reference in New Issue
Block a user