Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: When winget.exe fails to export package list to file, Get-WGInstalled returns an unrelated error message #16

Open
5 tasks done
bsudano opened this issue Oct 28, 2022 · 1 comment
Assignees
Labels
bug Something isn't working triage new issue that needs review

Comments

@bsudano
Copy link

bsudano commented Oct 28, 2022

Describe the problem

Running Get-WGInstalled -Verbose returns the following output:

VERBOSE: [14:14:23.7692236 BEGIN  ] Starting Get-WGInstalled
VERBOSE: [14:14:23.7695455] Starting Get-WGPath
VERBOSE: [14:14:23.7996964] Running as domain\ben
VERBOSE: [14:14:23.7999407] Using user default location
VERBOSE: [14:14:23.8001315] Ending Get-WGPath
VERBOSE: [14:14:23.8003343 PROCESS] Building list of packages with a winget source
WARNING: There was a problem getting a list of installed packages.
Get-Job: C:\Users\ben\Documents\PowerShell\Modules\WingetTools\1.6.0\functions\Get-WGInstalled.ps1:122
Line |
 122 |          if (Get-Job -Name wg) {
     |              ~~~~~~~~~~~~~~~~
     | The command cannot find the job because the job name wg was not found. Verify the value of the Name parameter, and then try the command again.

VERBOSE: [14:14:33.4908814 END    ] Ending Get-WGInstalled

Running & $winget export -s winget -o $tmpFile --include-versions directly produces the following error from winget.exe at the end of the output:

...
An unexpected error occurred while executing the command: 
Download request status is not success.
0x80190194 : Not found (404).

Expectation

Expectation was that if there were an internal winget.exe error, PowerShell's error stream would reflect that

Additional Information

I suppressed the Get-Job error by modifying line 122 in this way:

        if ('wg' -in (Get-Job).Name) {

But I am unsure of the best way to write useful error information from Winget to the PS error stream.

PowerShell version

7.2

Platform

Windows 10 Pro or Enterprise

Additional Checks

  • You are using the latest version of this module.
  • You have read this repository's README file.
  • You have read full help and examples for the command you are having problems with.
  • You are running PowerShell in an elevated session.
  • You are running in a traditional PowerShell console or Windows Terminal
@bsudano bsudano added bug Something isn't working triage new issue that needs review labels Oct 28, 2022
@jdhitsolutions
Copy link
Owner

winget doesn't behave like a typical command line tool, so this is indeed difficult. I'll see what I can do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage new issue that needs review
Projects
None yet
Development

No branches or pull requests

2 participants