You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2018/10/17 19:41:21 UTC

[karaf] branch karaf-4.1.x updated: KARAF-5980 use jline terminal for ssh instead of ignoring the environment

This is an automated email from the ASF dual-hosted git repository.

jbonofre pushed a commit to branch karaf-4.1.x
in repository https://gitbox.apache.org/repos/asf/karaf.git


The following commit(s) were added to refs/heads/karaf-4.1.x by this push:
     new e4589b8  KARAF-5980 use jline terminal for ssh instead of ignoring the environment
e4589b8 is described below

commit e4589b8fddaa0aff04ddff8e1fffc5a2f8a4dac4
Author: Romain Manni-Bucau <rm...@gmail.com>
AuthorDate: Wed Oct 17 16:51:40 2018 +0200

    KARAF-5980 use jline terminal for ssh instead of ignoring the environment
---
 .../java/org/apache/karaf/shell/ssh/ShellFactoryImpl.java     | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/ShellFactoryImpl.java b/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/ShellFactoryImpl.java
index 364bafe..5c398fe 100644
--- a/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/ShellFactoryImpl.java
+++ b/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/ShellFactoryImpl.java
@@ -98,11 +98,12 @@ public class ShellFactoryImpl implements Factory<Command> {
                 final Subject subject = ShellImpl.this.session != null ? ShellImpl.this.session
                         .getAttribute(KarafJaasAuthenticator.SUBJECT_ATTRIBUTE_KEY) : null;
                 String encoding = getEncoding(env);
-                final PrintStream pout = out instanceof PrintStream ? (PrintStream) out : new PrintStream(out, true, encoding);
-                final PrintStream perr = err instanceof PrintStream ? (PrintStream) err : out == err ? pout : new PrintStream(err, true, encoding);
-                terminal = new SshTerminal(env, in, pout);
-                shell = sessionFactory.create(in,
-                        pout, perr, terminal, encoding, this::destroy);
+                terminal = new SshTerminal(env, in, out);
+                final PrintStream pout = new PrintStream(terminal.output(), true, encoding);
+                final PrintStream perr = err instanceof PrintStream ?
+                        (PrintStream) err : out == err ? pout : new PrintStream(err, true, encoding);
+                shell = sessionFactory.create(in, pout,
+                        perr, terminal, encoding, this::destroy);
                 for (Map.Entry<String, String> e : env.getEnv().entrySet()) {
                     shell.put(e.getKey(), e.getValue());
                 }