winget-cli
winget-cli copied to clipboard
Find-WinGetPackage always results in $? being true
Brief description of your issue
When using Find-WinGetPackage, even when no packages are found, the result of $? will always be True
Steps to reproduce
Find-WinGetPackage -Id asdfasdfadsf; $?
Expected behavior
If one or more packages is found, $? should be true. If no packages are found $? should be false.
This should match the behavior of winget search where winget search Google.Chrome; $? returns true but winget search asdfasdfasdfad; $? returns false
Actual behavior
$? always returns true after Find-WinGetPackage
Environment
PS E:\winget-pkgs> winget --info
Windows Package Manager (Preview) v1.9.2411-preview
Copyright (c) Microsoft Corporation. All rights reserved.
Windows: Windows.Desktop v10.0.22631.4317
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.24.2411.0
PS E:\winget-pkgs> Get-Module -ListAvailable -Name Microsoft.WinGet.Client
Directory: C:\Users\Trenly\Documents\PowerShell\Modules
ModuleType Version PreRelease Name PSEdition ExportedCommands
---------- ------- ---------- ---- --------- ----------------
Binary 1.9.2411 Microsoft.WinGet.Client Core,Desk {Get-WinGetVersion, Find-WinGetPackage, Get-WinGetPackage, Get-WinGetSource…}