From 76c7c3f52c8ff9328277daa2fe1fe2c6d37834ff Mon Sep 17 00:00:00 2001 From: hayakawa Date: Thu, 18 Apr 2024 16:24:56 -0700 Subject: [PATCH] Added check if Matlab installed before running powershell commands that rely on its installation. --- BuildTestRelease.ps1 | 6 +++++- BuildTestReleaseMCCL.ps1 | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/BuildTestRelease.ps1 b/BuildTestRelease.ps1 index 5a1cf3a6f..8e4286f63 100644 --- a/BuildTestRelease.ps1 +++ b/BuildTestRelease.ps1 @@ -2,6 +2,10 @@ $mccl_version = "7.3.0" $matlab_version = "10.0.0" Invoke-Expression ".\BuildTestReleaseMCCL.ps1 $mccl_version" -Invoke-Expression ".\BuildTestReleaseMATLAB.ps1 $matlab_version" +# only run if matlab installed +if (Get-Command "matlab" -ErrorAction SilentlyContinue) +{ + Invoke-Expression ".\BuildTestReleaseMATLAB.ps1 $matlab_version" +} Read-Host -Prompt "Press Enter to exit" diff --git a/BuildTestReleaseMCCL.ps1 b/BuildTestReleaseMCCL.ps1 index 2c55a8df8..d1d5374cc 100644 --- a/BuildTestReleaseMCCL.ps1 +++ b/BuildTestReleaseMCCL.ps1 @@ -102,8 +102,12 @@ New-Item $MCmatlabdir -ItemType "directory" $MCresults = "$vtslevel\publish\local\one_layer_all_detectors\*" Copy-Item -Path $MCresults -Destination $MCmatlabdir -Recurse -ErrorAction Ignore -# run load_results_script (default datanames is set to one_layer_all_detectors) -matlab -wait -r "load_results_script; quit" +# only run following commands if matlab installed +if (Get-Command "matlab" -ErrorAction SilentlyContinue) +{ + # run load_results_script (default datanames is set to one_layer_all_detectors) + matlab -wait -r "load_results_script; quit" +} #cleanup one_layer_all_detectors folder Remove-Item $MCmatlabdir -Recurse -ErrorAction Ignore