Claus Ibsen created CAMEL-23608:
-----------------------------------
Summary: camel-jbang - CLI commands leak terminal escape sequences
from JLine terminal width detection
Key: CAMEL-23608
URL: https://issues.apache.org/jira/browse/CAMEL-23608
Project: Camel
Issue Type: Bug
Components: camel-jbang
Reporter: Claus Ibsen
After CAMEL-23237 (PR #22219, commit 5a1a83630622), CLI commands like {{camel
ps}} leak terminal escape sequences into the shell.
The output looks like:
{code}
PID NAME READY STATUS AGE TOTAL FAIL INFLIGHT
89933 circuit-breaker 1/1 Running 2m1s 119 32 0
^[[?64;1;2;4;6;17;18;21;22;52c^[[2;1R%
{code}
The garbage characters are DA1 (Device Attributes) and CPR (Cursor Position
Report) responses. {{TerminalWidthHelper.getTerminalWidth()}} creates a JLine
{{Terminal}} with {{system(true)}} which sends escape sequence queries to the
terminal. The terminal responds, but the responses arrive after the
{{Terminal}} is closed and leak into the shell.
The fix should avoid JLine for simple width detection — use {{COLUMNS}} env var
or {{stty size}} instead, which do not send escape sequences.
Introduced in: commit {{5a1a83630622}} / [PR
#22219|https://github.com/apache/camel/pull/22219] / CAMEL-23237
File:
{{dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/TerminalWidthHelper.java}}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)