Skip to content

Report PowerShell 5.x module operation failures instead of success - #5309

Merged
Gabriel Dufresne (GabrielDuf) merged 1 commit into
mainfrom
fix/5251-powershell-silent-update-failure
Aug 21, 2026
Merged

Report PowerShell 5.x module operation failures instead of success#5309
Gabriel Dufresne (GabrielDuf) merged 1 commit into
mainfrom
fix/5251-powershell-silent-update-failure

Conversation

@GabrielDuf

Copy link
Copy Markdown
Contributor

This pull request improves error handling in PowerShell package operations by ensuring that non-terminating errors are properly propagated to the exit code, unless the user explicitly overrides error variable handling. It also adds comprehensive tests to verify this behavior.

PowerShell error handling improvements:

  • Added a constant ErrorVariableName to PowerShellPkgOperationHelper to standardize the error variable used for capturing errors.
  • Modified parameter generation logic in PowerShellPkgOperationHelper to automatically add -ErrorVariable and an exit code check (;if($ErrorVariableName){exit(1)}) unless custom error variable parameters are supplied by the user.

Testing enhancements:

  • Added tests to ensure non-terminating errors are correctly propagated to the exit code for all operation types, and that custom error variable parameters are respected and not overridden.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves PowerShell 5.x package operations so non-terminating errors produce failure exit codes.

Changes:

  • Captures cmdlet errors using a standardized error variable.
  • Exits with code 1 when captured errors exist.
  • Adds coverage for all operation types and custom error-variable handling.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/UniGetUI.PackageEngine.Managers.PowerShell/Helpers/PowerShellPkgOperationHelper.cs Adds error capture and exit-code propagation.
src/UniGetUI.PackageEngine.Tests/PowerShellManagerTests.cs Tests error propagation and custom parameter behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@GabrielDuf
Gabriel Dufresne (GabrielDuf) merged commit 357e1b1 into main Aug 21, 2026
9 of 10 checks passed
@GabrielDuf
Gabriel Dufresne (GabrielDuf) deleted the fix/5251-powershell-silent-update-failure branch August 21, 2026 20:01
@GabrielDuf Gabriel Dufresne (GabrielDuf) linked an issue Aug 21, 2026 that may be closed by this pull request
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] PS module update status successful but nothing done

3 participants