Skip to content

CAMEL-23385: Fix watch mode exit and terminal resource leak#23130

Merged
davsclaus merged 1 commit into
apache:mainfrom
gnodet:CAMEL-23385-fix-watch-mode-bugs
May 12, 2026
Merged

CAMEL-23385: Fix watch mode exit and terminal resource leak#23130
davsclaus merged 1 commit into
apache:mainfrom
gnodet:CAMEL-23385-fix-watch-mode-bugs

Conversation

@gnodet
Copy link
Copy Markdown
Contributor

@gnodet gnodet commented May 12, 2026

CAMEL-23385

Follow-up to #23121 — fixes three bugs introduced in the watch mode implementation:

  1. Shadowed running variable prevents watch exit: ActionWatchCommand.doCall() declared a local AtomicBoolean running that shadowed the field. The waitForUserEnter() method set the field to false, but the loop checked the local — so pressing Enter could never exit the watch loop.

  2. CamelRouteDiagramAction.waitForUserEnter() never signals stop: The override read a line from lineReader but never called running.set(false), so even without the shadowing bug, the loop would continue after the user pressed Enter.

  3. Terminal resource leak: The terminal opened in doCall() was stored as a field but never closed. Wrapped in try/finally to ensure cleanup.

- Remove shadowed local variable in ActionWatchCommand.doCall() that
  prevented the watch loop from exiting when the user presses Enter
- Set running flag to false in CamelRouteDiagramAction.waitForUserEnter()
  after lineReader.readLine() returns
- Close terminal in finally block to prevent resource leak

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@gnodet gnodet requested a review from davsclaus May 12, 2026 05:49
@github-actions github-actions Bot added the dsl label May 12, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@github-actions
Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • dsl/camel-jbang/camel-jbang-core

⚠️ Some tests are disabled on GitHub Actions (@DisabledIfSystemProperty(named = "ci.env.name")) and require manual verification:

  • dsl/camel-jbang/camel-jbang-core: 1 test(s) disabled on GitHub Actions

💡 Manual integration tests recommended:

You modified dsl/camel-jbang/camel-jbang-core. The related integration tests in dsl/camel-jbang/camel-jbang-it are excluded from CI. Consider running them manually:

mvn verify -f dsl/camel-jbang/camel-jbang-it -Djbang-it-test
All tested modules (6 modules)
  • Camel :: JBang :: Core
  • Camel :: JBang :: MCP
  • Camel :: JBang :: Plugin :: Route Parser
  • Camel :: JBang :: Plugin :: TUI
  • Camel :: JBang :: Plugin :: Validate
  • Camel :: Launcher :: Container

⚙️ View full build and test results

@davsclaus davsclaus merged commit f188ef1 into apache:main May 12, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants