chore: Reuse shell terminal for TUI subcommands#23484
Open
gnodet wants to merge 2 commits into
Open
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>
When running TUI commands (tui, tui catalog) inside camel shell, the TUI crashes with "Stream Closed" because TamboUI tries to create a second system terminal while the shell already owns stdin. Add TuiBackendHelper that checks for an active shell terminal via EnvironmentHelper.getActiveTerminal() and passes it to JLineBackend via TuiConfig, so the TUI reuses the shell's terminal instead of creating a new one. Falls back to TuiRunner.create() when JLineBackend(Terminal) is not available (requires tamboui/tamboui#351).
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)
|
oscerd
approved these changes
May 23, 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
Running
tuiortui cataloginsidecamel shellcrashes withStream Closedbecause TamboUI'sJLineBackendtries to create a second system terminal while the shell already owns stdin.This PR adds a
TuiBackendHelperthat:EnvironmentHelper.getActiveTerminal()for an active shell terminalJLineBackend(terminal)via reflection and passes it throughTuiConfig.builder().backend(backend)TuiRunner.create()when theJLineBackend(Terminal)constructor is not availableDepends on:
EnvironmentHelper)JLineBackend(Terminal)constructor)Changes:
TuiBackendHelper.createTuiRunner()in the TUI pluginCamelMonitorandCamelCatalogTuiuse the helper instead ofTuiRunner.create()Test plan
camel shell→tuiworks without "Stream Closed" crash (with tamboui SNAPSHOT containing the new constructor)camel tuioutside shell continues to work (creates its own terminal as before)Claude Code on behalf of Guillaume Nodet