You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by gn...@apache.org on 2016/10/03 13:37:33 UTC

[6/7] karaf git commit: Make sure jline reader can see session variables

Make sure jline reader can see session variables

Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/f6291b9a
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/f6291b9a
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/f6291b9a

Branch: refs/heads/master
Commit: f6291b9a2ee4f1b50ebcc585a62541d2b6ac68b9
Parents: bb3f66a
Author: Guillaume Nodet <gn...@apache.org>
Authored: Mon Oct 3 15:34:47 2016 +0200
Committer: Guillaume Nodet <gn...@apache.org>
Committed: Mon Oct 3 15:34:47 2016 +0200

----------------------------------------------------------------------
 .../shell/impl/console/ConsoleSessionImpl.java  | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/f6291b9a/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java
----------------------------------------------------------------------
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 f390b27..ff3cbfd 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
@@ -35,6 +35,7 @@ import java.util.regex.Pattern;
 
 import org.apache.felix.gogo.api.Job;
 import org.apache.felix.gogo.api.Job.Status;
+import org.apache.felix.gogo.runtime.CommandSessionImpl;
 import org.apache.felix.service.command.CommandProcessor;
 import org.apache.felix.service.command.CommandSession;
 import org.apache.felix.service.command.Converter;
@@ -125,14 +126,16 @@ public class ConsoleSessionImpl implements Session {
             }
         }
 
+        // Create session
+        session = processor.createSession(jlineTerminal.input(),
+                jlineTerminal.output(),
+                jlineTerminal.output());
+
         // Console reader
-        try {
-            reader = new LineReaderImpl(
-                    jlineTerminal,
-                    "karaf");
-        } catch (IOException e) {
-            throw new RuntimeException("Error opening console reader", e);
-        }
+        reader = new LineReaderImpl(
+                jlineTerminal,
+                "karaf",
+                ((CommandSessionImpl) session).getVariables());
 
         // History
         final File file = getHistoryFile();
@@ -168,9 +171,6 @@ public class ConsoleSessionImpl implements Session {
         registry.register(new FileOrUriCompleter());
 
         // Session
-        session = processor.createSession(jlineTerminal.input(),
-                                          jlineTerminal.output(),
-                                          jlineTerminal.output());
         Properties sysProps = System.getProperties();
         for (Object key : sysProps.keySet()) {
             session.put(key.toString(), sysProps.get(key));