This is an automated email from the ASF dual-hosted git repository.
jbonofre pushed a commit to branch karaf-4.4.x
in repository https://gitbox.apache.org/repos/asf/karaf.git
The following commit(s) were added to refs/heads/karaf-4.4.x by this push:
new 1d7b5ed74f fix(shell): enable autoFlush on console PrintStream (#2267)
(#2518) (#2538)
1d7b5ed74f is described below
commit 1d7b5ed74f6f38a5ea47ebd812eaaa39511a8472
Author: JB Onofré <[email protected]>
AuthorDate: Wed Apr 15 18:47:16 2026 +0200
fix(shell): enable autoFlush on console PrintStream (#2267) (#2518) (#2538)
System.out.print() without a newline was not displayed immediately on
the Karaf console because the PrintStream wrapping the terminal output
was created without autoFlush. Enable autoFlush on the local console
and SSH command PrintStreams, consistent with ShellFactoryImpl.
---
.../org/apache/karaf/shell/impl/console/osgi/LocalConsoleManager.java | 2 +-
shell/ssh/src/main/java/org/apache/karaf/shell/ssh/ShellCommand.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git
a/shell/core/src/main/java/org/apache/karaf/shell/impl/console/osgi/LocalConsoleManager.java
b/shell/core/src/main/java/org/apache/karaf/shell/impl/console/osgi/LocalConsoleManager.java
index 440e05afea..3cf7b175b5 100644
---
a/shell/core/src/main/java/org/apache/karaf/shell/impl/console/osgi/LocalConsoleManager.java
+++
b/shell/core/src/main/java/org/apache/karaf/shell/impl/console/osgi/LocalConsoleManager.java
@@ -77,7 +77,7 @@ public class LocalConsoleManager {
final Subject subject = createLocalKarafSubject();
this.session = JaasHelper.doAs(subject, (PrivilegedAction<Session>) ()
-> {
String encoding = getEncoding();
- PrintStream pout = new PrintStream(terminal.output()) {
+ PrintStream pout = new PrintStream(terminal.output(), true,
Charset.forName(encoding)) {
@Override
public void close() {
// do nothing
diff --git
a/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/ShellCommand.java
b/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/ShellCommand.java
index 1affedb054..a591bbcb80 100644
--- a/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/ShellCommand.java
+++ b/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/ShellCommand.java
@@ -97,7 +97,7 @@ public class ShellCommand implements Command {
public void run() {
int exitStatus = 0;
try {
- final Session session = sessionFactory.create(in, new
PrintStream(out), new PrintStream(err));
+ final Session session = sessionFactory.create(in, new
PrintStream(out, true), new PrintStream(err, true));
for (Map.Entry<String,String> e : env.getEnv().entrySet()) {
session.put(e.getKey(), e.getValue());
}