use jline terminal for ssh instead of ignoring the environment
@@ -96,11 +96,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());
}
