FELIX-1748: make the command history persistent across restarts
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@824761 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/karaf/shell/console/src/main/java/org/apache/felix/karaf/shell/console/jline/Console.java b/karaf/shell/console/src/main/java/org/apache/felix/karaf/shell/console/jline/Console.java
index 858e5bc..9a172ae 100644
--- a/karaf/shell/console/src/main/java/org/apache/felix/karaf/shell/console/jline/Console.java
+++ b/karaf/shell/console/src/main/java/org/apache/felix/karaf/shell/console/jline/Console.java
@@ -18,6 +18,7 @@
*/
package org.apache.felix.karaf.shell.console.jline;
+import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;
@@ -67,7 +68,7 @@
Terminal term,
Completer completer,
Runnable closeCallback,
- Callable<Boolean> printStackTraces ) throws Exception
+ Callable<Boolean> printStackTraces) throws Exception
{
this.in = in;
this.out = out;
@@ -84,6 +85,10 @@
new PrintWriter(this.out),
getClass().getResourceAsStream("keybinding.properties"),
this.terminal);
+
+ File file = new File(System.getProperty("user.home"), ".karaf/karaf.history");
+ file.getParentFile().mkdirs();
+ reader.getHistory().setHistoryFile(file);
if (completer != null) {
reader.addCompletor(new CompleterAsCompletor(completer));
}