aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorHauke Günther <hauke.guenther@sieb-meyer.de>2022-06-22 22:15:27 +0200
committerHauke Günther <hauke.guenther@sieb-meyer.de>2022-06-24 14:39:16 +0200
commit268d0ffa05d97eb9c836e790b9a4a25a9d1d49fd (patch)
tree15cac541497e16c4b1fce53be61f37128f770c85 /scripts
parentbf0f834e8036153fabdecdbf0a926764b523aaac (diff)
downloadghdl-268d0ffa05d97eb9c836e790b9a4a25a9d1d49fd.tar.gz
ghdl-268d0ffa05d97eb9c836e790b9a4a25a9d1d49fd.tar.bz2
ghdl-268d0ffa05d97eb9c836e790b9a4a25a9d1d49fd.zip
Fix error when ghdl.exe is searched with Get-Command but not found
Without adding `-ErrorAction Stop` the routine does not go into the catch case but continues to run with an undefined variable `$GHDLBinary`.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/vendors/shared.psm111
1 files changed, 7 insertions, 4 deletions
diff --git a/scripts/vendors/shared.psm1 b/scripts/vendors/shared.psm1
index bc6f6f93c..51f492874 100644
--- a/scripts/vendors/shared.psm1
+++ b/scripts/vendors/shared.psm1
@@ -156,16 +156,19 @@ function Get-GHDLBinary
{ $GHDLBinary = $env:GHDL }
else
{ try
- { write-host "calling which ..."
- $GHDLBinary = (Get-Command "ghdl.exe").Source }
+ { Write-host "Calling Get-Command ..."
+ $GHDLBinary = (Get-Command "ghdl.exe" -ErrorAction Stop).Source }
catch
- { Write-Host "Use adv. options '-GHDL' to set the GHDL executable." -ForegroundColor Red
+ { Write-Host "Cannot find ghdl.exe." -ForegroundColor Red
+ Write-Host "Use adv. options '-GHDL' to set the GHDL executable." -ForegroundColor Red
Exit-CompileScript -1
}
}
if (-not (Test-Path $GHDLBinary -PathType Leaf))
- { Write-Host "Use adv. options '-GHDL' to set the GHDL executable." -ForegroundColor Red
+ {
+ Write-Host "$GHDLBinary is not a file." -ForegroundColor Red
+ Write-Host "Use adv. options '-GHDL' to set the GHDL executable." -ForegroundColor Red
Exit-CompileScript -1
}