From 268d0ffa05d97eb9c836e790b9a4a25a9d1d49fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hauke=20G=C3=BCnther?= Date: Wed, 22 Jun 2022 22:15:27 +0200 Subject: 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`. --- scripts/vendors/shared.psm1 | 11 +++++++---- 1 file 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 } -- cgit v1.2.3 From 890b2fc4abc5717bec33c77829353e2264a3762c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hauke=20G=C3=BCnther?= Date: Wed, 22 Jun 2022 22:15:28 +0200 Subject: Update docstring for GHDL parameter of PoSh scripts --- scripts/vendors/compile-altera.ps1 | 2 +- scripts/vendors/compile-intel.ps1 | 2 +- scripts/vendors/compile-lattice.ps1 | 2 +- scripts/vendors/compile-osvvm.ps1 | 2 +- scripts/vendors/compile-uvvm.ps1 | 2 +- scripts/vendors/compile-xilinx-ise.ps1 | 2 +- scripts/vendors/compile-xilinx-vivado.ps1 | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/vendors/compile-altera.ps1 b/scripts/vendors/compile-altera.ps1 index 0c1f948cf..9587d3b86 100644 --- a/scripts/vendors/compile-altera.ps1 +++ b/scripts/vendors/compile-altera.ps1 @@ -81,7 +81,7 @@ param( [string]$Source = "", # Set output directory name. [string]$Output = "", - # Set GHDL binary directory. + # Set path to GHDL's executable, e.g. /bin/ghdl.exe [string]$GHDL = "" ) diff --git a/scripts/vendors/compile-intel.ps1 b/scripts/vendors/compile-intel.ps1 index 0e3ba781c..711daa80d 100644 --- a/scripts/vendors/compile-intel.ps1 +++ b/scripts/vendors/compile-intel.ps1 @@ -81,7 +81,7 @@ param( [string]$Source = "", # Set output directory name. [string]$Output = "", - # Set GHDL binary directory. + # Set path to GHDL's executable, e.g. /bin/ghdl.exe [string]$GHDL = "" ) diff --git a/scripts/vendors/compile-lattice.ps1 b/scripts/vendors/compile-lattice.ps1 index 7e36c322d..6fba8af9c 100644 --- a/scripts/vendors/compile-lattice.ps1 +++ b/scripts/vendors/compile-lattice.ps1 @@ -94,7 +94,7 @@ param( [string]$Source = "", # Set output directory name. [string]$Output = "", - # Set GHDL binary directory. + # Set path to GHDL's executable, e.g. /bin/ghdl.exe [string]$GHDL = "" ) diff --git a/scripts/vendors/compile-osvvm.ps1 b/scripts/vendors/compile-osvvm.ps1 index d93ca2d1d..93bb0babe 100644 --- a/scripts/vendors/compile-osvvm.ps1 +++ b/scripts/vendors/compile-osvvm.ps1 @@ -62,7 +62,7 @@ param( [string]$Source = "", # Set output directory name. [string]$Output = "", - # Set GHDL binary directory. + # Set path to GHDL's executable, e.g. /bin/ghdl.exe [string]$GHDL = "" ) diff --git a/scripts/vendors/compile-uvvm.ps1 b/scripts/vendors/compile-uvvm.ps1 index a8960be85..85f7a6046 100644 --- a/scripts/vendors/compile-uvvm.ps1 +++ b/scripts/vendors/compile-uvvm.ps1 @@ -95,7 +95,7 @@ param( [string]$Source = "", # Set output directory name. [string]$Output = "", - # Set GHDL binary directory. + # Set path to GHDL's executable, e.g. /bin/ghdl.exe [string]$GHDL = "" ) diff --git a/scripts/vendors/compile-xilinx-ise.ps1 b/scripts/vendors/compile-xilinx-ise.ps1 index 39b363117..0d5730c0c 100644 --- a/scripts/vendors/compile-xilinx-ise.ps1 +++ b/scripts/vendors/compile-xilinx-ise.ps1 @@ -72,7 +72,7 @@ param( [string]$Source = "", # Set output directory name. [string]$Output = "", - # Set GHDL binary directory. + # Set path to GHDL's executable, e.g. /bin/ghdl.exe [string]$GHDL = "" ) diff --git a/scripts/vendors/compile-xilinx-vivado.ps1 b/scripts/vendors/compile-xilinx-vivado.ps1 index a411ababa..bdf9c8b3d 100644 --- a/scripts/vendors/compile-xilinx-vivado.ps1 +++ b/scripts/vendors/compile-xilinx-vivado.ps1 @@ -64,7 +64,7 @@ param( [string]$Source = "", # Set output directory name. [string]$Output = "", - # Set GHDL binary directory. + # Set path to GHDL's executable, e.g. /bin/ghdl.exe [string]$GHDL = "" ) -- cgit v1.2.3