karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject [karaf] branch karaf-4.1.x updated: [KARAF-5689] Console is broken after Ctrl+C
Date Thu, 02 Aug 2018 19:09:16 GMT
This is an automated email from the ASF dual-hosted git repository.

gnodet 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 e64004d  [KARAF-5689] Console is broken after Ctrl+C
e64004d is described below

commit e64004d1361039f5950a5e96e080843aa970220d
Author: Guillaume Nodet <gnodet@gmail.com>
AuthorDate: Thu Aug 2 13:42:42 2018 +0200

    [KARAF-5689] Console is broken after Ctrl+C
---
 .../apache/karaf/shell/impl/console/ConsoleSessionImpl.java    |  4 +---
 .../karaf/shell/impl/console/osgi/LocalConsoleManager.java     | 10 ++++++++--
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java
b/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java
index a9695f8..662cd50 100644
--- a/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java
+++ b/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java
@@ -135,9 +135,7 @@ public class ConsoleSessionImpl implements Session {
         }
 
         // Create session
-        session = processor.createSession(jlineTerminal.input(),
-                jlineTerminal.output(),
-                jlineTerminal.output());
+        session = processor.createSession(in, out, err);
 
         // Completers
         Completers.CompletionEnvironment env = new Completers.CompletionEnvironment() {
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 0ee97df..0a27fd2 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
@@ -68,10 +68,16 @@ public class LocalConsoleManager {
         this.session = JaasHelper.doAs(subject, new PrivilegedAction<Session>() {
             public Session run() {
                 String encoding = getEncoding();
+	            PrintStream pout = new PrintStream(terminal.output()) {
+	                @Override
+	                public void close() {
+	                    // do nothing
+	                }
+	            };
                 session = sessionFactory.create(
                                       terminal.input(),
-                                      new PrintStream(terminal.output()),
-                                      new PrintStream(terminal.output()),
+                                      pout,
+                                      pout,
                                       new JLineTerminal(terminal),
                                       encoding, 
                                       LocalConsoleManager.this::close);


Mime
View raw message