diff options
author | Thomas Powell <powell@progress.com> | 2022-10-28 12:48:22 -0400 |
---|---|---|
committer | Thomas Powell <powell@progress.com> | 2022-10-28 12:48:22 -0400 |
commit | 889fec3b8ea5a779ed2040647b56aed16b5c63f8 (patch) | |
tree | 5ff81fb236dcc7886bad94bc7afa3fa76695ba50 | |
parent | 4546b5de1394fd903c48ac8d9b55341c8a569217 (diff) | |
download | chef-889fec3b8ea5a779ed2040647b56aed16b5c63f8.tar.gz |
I guess we have to catch
Signed-off-by: Thomas Powell <powell@progress.com>
-rw-r--r-- | habitat/plan.ps1 | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/habitat/plan.ps1 b/habitat/plan.ps1 index 9de93f09d1..5a5b949b5c 100644 --- a/habitat/plan.ps1 +++ b/habitat/plan.ps1 @@ -53,9 +53,11 @@ function Invoke-Download() { Write-Host "--- :construction: Verifying Git is Installed" - $source = Get-Command -Name Git -Verbose - Write-Host "Which version of Git is installed? - " $source.version - if (-not ($source.name -match "git.exe")) { + try { + $source = Get-Command -Name Git -Verbose + + Write-Host "Which version of Git is installed? - " $source.version + } catch { choco install git -y # gotta refresh the path so you can actually use Git now $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") |