Skip to content

list --upgrade-available return code depends on the installation rather than upgradable #5677

@ArwynFr

Description

@ArwynFr

Relevant area(s)

WinGet CLI

Relevant command(s)

winget list

Brief description of your issue

When running winget list --upgrade-available, the return code of the command depends on whether the package is locally installed, rather than if there is an upgrade available. This makes it hard to check if a package has an upgrade avilable in scripts.

Steps to reproduce

# package installed outdated version
winget install OpenVPNTechnologies.OpenVPN --version 2.6.1402 --silent | Out-Null
winget list OpenVPNTechnologies.OpenVPN --upgrade-available | Out-Null ; $LastExitCode

# package installed latest version
winget upgrade OpenVPNTechnologies.OpenVPN --silent | Out-Null
winget list OpenVPNTechnologies.OpenVPN --upgrade-available | Out-Null ; $LastExitCode

# package not installed
winget uninstall OpenVPNTechnologies.OpenVPN | Out-Null
winget list OpenVPNTechnologies.OpenVPN --upgrade-available | Out-Null ; $LastExitCode

Expected behavior

0
Any non zero
-1978335212

Actual behavior

0
0
-1978335212

Environment

Winget v1.11.430
Windows.Desktop v10.0.26100.4946
Microsoft.DesktopAppInstaller v1.26.430.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Command-ListIssue related to WinGet ListIssue-BugIt either shouldn't be doing this or needs an investigation.Needs-Author-FeedbackIssue needs attention from issue or PR authorNo-Recent-ActivityIssue has no recent activity

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions