Skip to content

fix: return exit code 1 on parse errors - #1016

Open
Akhil Gupta (akhil9tiet) wants to merge 32 commits into
microsoft:mainfrom
akhil9tiet:fix/1015-parse-error-exit-code
Open

Akhil Gupta (akhil9tiet) wants to merge 32 commits into
microsoft:mainfrom
akhil9tiet:fix/1015-parse-error-exit-code

Conversation

@akhil9tiet

Copy link
Copy Markdown

Fixes #1015. Parse errors that print help (e.g. winapp cert bogus) exited with code 0, so scripts and agents treated them as success. InvokeAsync() displays the error and help text; this ensures the exit code is 1 when ParseResult.Errors is non-empty, matching the ui subcommands' behavior.

Copilot AI balanced review requested due to automatic review settings October 7, 2026 20:58

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

🟡 Changes recommended

The new await is inside a non-async lambda, causing Release builds and tests to fail compilation.

2 open findings

🧠 Review effort: Balanced

Comment thread src/winapp-CLI/WinApp.Cli/Program.cs
Comment thread src/winapp-CLI/WinApp.Cli/Program.cs Outdated
@akhil9tiet

Copy link
Copy Markdown
Author

Added missing await.

@akhil9tiet

Copy link
Copy Markdown
Author

Follow-up to the Cli-2 failure: the only failing test was TelemetryTests.HostInvocation_PreservesOptOutAndDoesNotTreatArgumentValuesAsGuestMode — winapp --json run --help --args guest-agent must exit 0 (help request honoured), but the blanket parse-error → exit 1 override flipped it to 1. Commit 9b66209 exempts help / CLI-schema requests from the override (detected from the matched options, so it holds whether the parser selected the help action or a parse-error action). The cert bogus case from #1015 is unaffected (no --help, still exits 1), and the InvokeWithHelpPointerAsync override is unchanged.

…r-exit-code

# Conflicts:
#	src/winapp-CLI/WinApp.Cli/Program.cs
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.

[Bug]: Parse errors that print help exit 0 (e.g. winapp cert bogus)

4 participants