diff options
author | Piotr Srebrny <piotr.srebrny@qt.io> | 2022-04-01 11:56:57 +0200 |
---|---|---|
committer | Piotr Srebrny <piotr.srebrny@qt.io> | 2022-04-29 13:06:03 +0000 |
commit | 9196022e01beb0213139ce188411b27ab1cd99e9 (patch) | |
tree | 8bacd9d9c15873f7f3e1b349a2762f815b3758b4 /coin/provisioning | |
parent | 30068f2223b112650a1fb61ca6fd3b42cb26fcd3 (diff) |
Make Copy-Item to throw exception if source does not exist
Copy-Item command does not throw by default. Thus, copying error is
not caught and the Download function returns without downloading from
the official site. Adding "-errorAction stop" makes Copy-Item to throw
an exception as expected in the script.
Change-Id: I889cccac775705613e641453aca9e0197645f344
Reviewed-by: Simo Fält <simo.falt@qt.io>
Reviewed-by: Toni Saario <toni.saario@qt.io>
Diffstat (limited to 'coin/provisioning')
-rw-r--r-- | coin/provisioning/common/windows/helpers.ps1 | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/coin/provisioning/common/windows/helpers.ps1 b/coin/provisioning/common/windows/helpers.ps1 index 8599791d..1967b02a 100644 --- a/coin/provisioning/common/windows/helpers.ps1 +++ b/coin/provisioning/common/windows/helpers.ps1 @@ -148,7 +148,7 @@ function Download if ($CachedUrl.StartsWith("http")) { Invoke-WebRequest -UseBasicParsing $CachedUrl -OutFile $Destination } else { - Copy-Item $CachedUrl $Destination + Copy-Item $CachedUrl $Destination -errorAction stop } } catch { Write-Host "Cached download failed: Downloading from official location: $OfficialUrl" |