Skip to content

fix #2771 and #2772 - Option action fixes#2782

Open
jonsequitur wants to merge 2 commits intodotnet:mainfrom
jonsequitur:fix-2771-and-2772
Open

fix #2771 and #2772 - Option action fixes#2782
jonsequitur wants to merge 2 commits intodotnet:mainfrom
jonsequitur:fix-2771-and-2772

Conversation

@jonsequitur
Copy link
Copy Markdown
Contributor

@jonsequitur jonsequitur commented Mar 11, 2026

Fixes #2771
Fixes #2772

This pull request improves how non-terminating option actions are handled in the command-line invocation pipeline, ensuring their return values are correctly propagated and prioritized over command actions when appropriate. It also adds comprehensive tests for these scenarios and refactors the test action helpers to support custom return values.

  • Refactored InvocationPipeline.Invoke and InvokeAsync to propagate the return value from non-terminating pre-actions (such as option actions) and ensure that if both a pre-action and a command action return nonzero exit codes, the pre-action's value takes precedence. If no command action is present, the pre-action's return value is used; otherwise, the command action's return value is used only if all pre-actions return zero.

@jonsequitur jonsequitur changed the title fix #2771 and #2772 fix #2771 and #2772 - Option action fixes Mar 31, 2026
Copy link
Copy Markdown
Member

@jeffhandley jeffhandley left a comment

Choose a reason for hiding this comment

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

Just one suggestion, but looks good. I also updated the PR description to add more context.

@jonsequitur jonsequitur enabled auto-merge (squash) April 2, 2026 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The return value from Option actions is discarded Option actions are only invoked if the parent Command has an action

2 participants