You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2022/10/05 08:51:07 UTC

[karaf] branch karaf-4.3.x updated: [KARAF-1381] - store karaf command history separately for each instance

This is an automated email from the ASF dual-hosted git repository.

jbonofre pushed a commit to branch karaf-4.3.x
in repository https://gitbox.apache.org/repos/asf/karaf.git


The following commit(s) were added to refs/heads/karaf-4.3.x by this push:
     new 66e2a379c4 [KARAF-1381] - store karaf command history separately for each instance
66e2a379c4 is described below

commit 66e2a379c4ee0dbd400a47fcc77ac1d949223757
Author: Aleksy Wróblewski <al...@bbbit.io>
AuthorDate: Tue Sep 27 17:22:14 2022 +0200

    [KARAF-1381] - store karaf command history separately for each instance
    
    (cherry picked from commit 36017375470307317f9578f688dca28e79c79f2b)
---
 .../org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java    | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

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 9878f076f5..ba7b941864 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
@@ -299,7 +299,12 @@ public class ConsoleSessionImpl implements Session {
      * @return the history file
      */
     protected Path getHistoryFile() {
-        String defaultHistoryPath = new File(System.getProperty("user.home"), ".karaf/karaf.history").toString();
+        String instanceName = System.getProperty("karaf.name", "root");
+        String historyFilePath = ".karaf/karaf.history";
+        if (!instanceName.equals("root")) {
+            historyFilePath += ("." + instanceName);
+        }
+        String defaultHistoryPath = new File(System.getProperty("user.home"), historyFilePath).toString();
         return Paths.get(System.getProperty("karaf.history", defaultHistoryPath));
     }