Repository navigation
Exit with non-zero status when command line verification fails - #563
Open
CatarinaGamboa wants to merge 1 commit into
Open
CatarinaGamboa wants to merge 1 commit into
CatarinaGamboa wants to merge 1 commit into
Conversation
CommandLineLauncher.main always returned normally, so the process exited with 0 even when verification reported errors, and scripts, CI jobs and exec-maven-plugin could not detect a failed verification. main now delegates to run(String...), which returns 1 when diagnostics contain an error and 0 otherwise, and calls System.exit only for a non-zero status. launch(...) is unchanged, so the language server that calls it is not affected. Fixes #562 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 #562
What and why
CommandLineLauncher.mainprinted the diagnostics and returned, so the process always exited with 0. CI jobs, scripts andexec-maven-plugincould not tell a failed verification from a passing one.mainnow delegates to a newrun(String...), which returns the exit status: 1 when diagnostics contain an error (including a path that was not found), 0 otherwise (pass,--help,--version).maincallsSystem.exitonly for a non-zero status, so a passing run undermvn exec:javastill ends normally, without stopping Maven early.launch(...)is unchanged, as the issue suggested, because the VS Code language server calls it and must not exit.Tests
TestCommandLineExitCode: error file → 1, correct file → 0, missing path → 1, and an error in an earlier run does not leak into a later passing run../liquidjava: exit 1 fora = -1, exit 0 fora = 1.mvn test: 771 tests, 4 failures. All 4 also fail onmainat 6a349c1 without this change, so this PR doesn't cause them:TestAliasExpansions.messageDeclaresEachAliasOnceAsWrittenTestDeclarationPositions.stateErrorPointsToEveryEntryStateWithWhatItMeansTestOriginNotes.unrefinedParameterIsNamedWithItsMethodTestStateHints.foundKeepsANamedStateSetByItsName🤖 Generated with Claude Code