chore: Fix commands using System.console() to work inside camel shell#23479
Open
gnodet wants to merge 1 commit into
Open
chore: Fix commands using System.console() to work inside camel shell#23479gnodet wants to merge 1 commit into
gnodet wants to merge 1 commit into
Conversation
Inside the JLine shell, System.console() returns null, causing subcommands that read interactive input to silently fail. This moves the active terminal reference to EnvironmentHelper so all commands can detect and use the shell's terminal for input/output. Commands fixed: - debug: user input (step, quit) now works inside shell - infra run: "press ENTER to stop" now works inside shell - init: interactive template picker now works inside shell - watch commands: "press enter" to stop now works inside shell - confirmOperation: interactive confirmation now works inside shell Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
Contributor
|
🧪 CI tested the following changed modules:
💡 Manual integration tests recommended:
All tested modules (6 modules)
|
This was referenced May 22, 2026
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.
Summary
Inside the JLine shell (
camel shell),System.console()returnsnull, causing subcommands that read interactive input to silently fail. For example,debugprints nothing because its input-reading thread NPEs onSystem.console().readLine()in a background thread.This PR:
EnvironmentHelper(incore.common) so all commands can detect and reuse the shell's JLine terminal for inputisColorEnabled()andisInteractiveTerminal()to check for the active terminalreadLine()helper that uses the terminal when inside the shell, falling back toSystem.console()System.console()directly:Debug— user input (step, quit, etc.) now works inside shellInfraRun— "press ENTER to stop" now works inside shellInit— interactive template picker now works inside shellCommandHelper.ReadConsoleTask— watch-mode "press enter to stop" now works inside shellCommandHelper.confirmOperation— interactive confirmation now works inside shellTest plan
camel shellthendebug hello.yaml— verify step/quit commands workcamel shelltheninit— verify interactive template picker appearscamel shelltheninfra run kafka— verify "press ENTER to stop" workscamel debug hello.yaml(outside shell) — verify still works as beforecamel init(outside shell) — verify interactive picker still worksmvn install -B -pl dsl/camel-jbang/camel-jbang-core -DskipTestsClaude Code on behalf of Guillaume Nodet