From 13e650486bb96e2f7c5ac515258e8c460addfad5 Mon Sep 17 00:00:00 2001 From: Joel Bennett Date: Sun, 2 Apr 2023 10:34:36 -0400 Subject: [PATCH] ChocolateyPackage: Avoid duplicate choco.exe (#70) Co-authored-by: Gael --- CHANGELOG.md | 3 ++- source/public/Install-ChocolateyPackage.ps1 | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08d8e8d..bd53a39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Modified project with new Sampler template. -- Invoking choco commands now always add `--no-progress` & `--limit-output` +- Invoking choco commands now always add `--no-progress` & `--limit-output`. +- Limiting Get-Command choco to the first result as per [#69](https://github.com/chocolatey-community/Chocolatey/issues/69). - Changed `ChocolateySoftware` to be class-based DSC Resource. - Changed `ChocolateyPackage` to be class-based DSC Resource. - Changed `ChocolateySource` to be a class-based DSC Resource. diff --git a/source/public/Install-ChocolateyPackage.ps1 b/source/public/Install-ChocolateyPackage.ps1 index 7337e51..a913c37 100644 --- a/source/public/Install-ChocolateyPackage.ps1 +++ b/source/public/Install-ChocolateyPackage.ps1 @@ -297,7 +297,7 @@ function Install-ChocolateyPackage begin { $null = $PSboundParameters.remove('Name') - if (-not ($chocoCmd = Get-Command 'choco.exe' -CommandType 'Application' -ErrorAction 'SilentlyContinue')) + if (-not ($chocoCmd = @(Get-Command 'choco.exe' -CommandType 'Application' -ErrorAction 'SilentlyContinue')[0])) { throw "Chocolatey Software not found." }