microsoft / microsoft/winget-cli

`winget source update` returns success (0) when it fails

Open
#2,679 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Command-Source Issue-Bug
Dominant language
C++
Stars
26.4k
Forks
1.8k
Avg merge
1d 11h
Merged PRs (30d)
15

Description

Brief description of your issue

The CDN being (at least partially) broken (#2666) seems like an unhandled exception in winget-cli, as it returns success / %errorlevel 0, no?

Following running in CMD as admin should not return success IMO.

C:\Windows\system32>winget source reset --force && winget source update && echo %errorlevel%
Resetting all sources...Done
Updating all sources...
Updating source: msstore...
Done
Updating source: winget...
Cancelled
0

C:\Windows\system32>
Steps to reproduce

Change DNS to replicate CDN being down?

Expected behavior

If sources can't in fact be updated, it should return an error.

Actual behavior

Says updating sources failed, but exit code 0 = success.

Environment
Windows Package Manager v1.3.2691
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.19045.2130
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.18.2691.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the winget source update command's failure handling and how its result becomes the process exit code. Reproduce the issue with a source or CDN failure, then verify that a failed update reports a nonzero exit code while a successful update still returns 0.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.