Repository navigation
Propagate command exit code from Main - #259
Merged
opcfoundation-org merged 1 commit intoSep 28, 2026
Merged
Conversation
Main was declared as `async Task` and discarded the value returned by ModelCompilerApplication.Run(). System.CommandLine catches exceptions thrown by command actions, prints them to stderr and returns a non-zero code, but that code was lost, so the process always exited with 0. Main now returns Task<int> and forwards the result. The catch blocks return 3 instead of calling Environment.Exit(3), keeping the same code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cailloumajor
added a commit
to cailloumajor/ua-nodeset-generator
that referenced
this pull request
Sep 28, 2026
Due to OPCFoundation/UA-ModelCompiler#259, model compiler tool always return success.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #258
Problem
Mainwas declared asasync Taskand discarded the exit code returned byModelCompilerApplication.Run(). System.CommandLine handles exceptions thrown by command actions (prints them to stderr, returns1), but that code was lost, so the tool always exited with0.Change
Mainnow returnsTask<int>and forwards the result ofModelCompilerApplication.Run(args).catchblocksreturn 3instead of callingEnvironment.Exit(3)(same exit code).Verification
compile -d2 /nonexistent.xml -o2 /tmp/outcompile --bogus(invalid option)--help🤖 Generated with Claude Code