Skip to content

[client] Do not close channel when stdin is not a terminal - #2926

Open
holgerfriedrich wants to merge 1 commit into
apache:mainfrom
holgerfriedrich:pr-client-output
Open

holgerfriedrich wants to merge 1 commit into
apache:mainfrom
holgerfriedrich:pr-client-output

Conversation

@holgerfriedrich

@holgerfriedrich holgerfriedrich commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

This allows scripts to run a console command and get the full command output. Closing with Strg-D as intended by KARAF-5995 should still be possible.

Background:
bin/client -u karaf -p karaf "shell:info" < /dev/null prints only "Closed" and exits 1 - same in scripts, pipes, CI and cron, and with -f. The stdin watcher (KARAF-5995, ctrl-d aborts a command) hits EOF at once and closes thechannel. It now starts only when stdin is a terminal.

As a new method was Console.isTerminal() was recently introduced in JDK22 and used if available.

This issue was found while debugging #2925 with AI support.

This allows scripts to run a console command and get the full command output.
Closing with Strg-D as intended by KARAF-5995 should still be possible.
@jbonofre
jbonofre self-requested a review September 20, 2026 07:35
@github-actions

Copy link
Copy Markdown

Test Results

  726 files  ±0    726 suites  ±0   1h 24m 0s ⏱️ + 8m 40s
  985 tests ±0    937 ✅ ±0   48 💤 ±0  0 ❌ ±0 
2 955 runs  ±0  2 811 ✅ ±0  144 💤 ±0  0 ❌ ±0 

Results for commit 1863e4d. ± Comparison against base commit a110f75.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant