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/11/22 19:48:10 UTC

karaf git commit: [KARAF-4837] Session#readLine should not append to history

Repository: karaf
Updated Branches:
  refs/heads/master c4aa24843 -> 29dd03c96


[KARAF-4837] Session#readLine should not append to history

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

Branch: refs/heads/master
Commit: 29dd03c964d458a418930b20e709f77797a1858d
Parents: c4aa248
Author: Guillaume Nodet <gn...@apache.org>
Authored: Tue Nov 22 20:48:02 2016 +0100
Committer: Guillaume Nodet <gn...@apache.org>
Committed: Tue Nov 22 20:48:02 2016 +0100

----------------------------------------------------------------------
 .../apache/karaf/shell/impl/console/ConsoleSessionImpl.java  | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/29dd03c9/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 3a9dc22..22d2a1e 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
@@ -68,6 +68,7 @@ import org.apache.karaf.shell.support.completers.UriCompleter;
 import org.jline.builtins.Completers;
 import org.jline.reader.*;
 import org.jline.reader.impl.LineReaderImpl;
+import org.jline.reader.impl.history.DefaultHistory;
 import org.jline.terminal.Terminal.Signal;
 import org.jline.terminal.impl.DumbTerminal;
 import org.slf4j.Logger;
@@ -420,7 +421,12 @@ public class ConsoleSessionImpl implements Session {
 
     @Override
     public String readLine(String prompt, Character mask) throws IOException {
-        return reader.readLine(prompt, mask);
+        try {
+            reader.getVariables().put(LineReader.DISABLE_HISTORY, Boolean.TRUE);
+            return reader.readLine(prompt, mask);
+        } finally {
+            reader.getVariables().remove(LineReader.DISABLE_HISTORY);
+        }
     }
 
     private String loadCompletionMode() {