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

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


The following commit(s) were added to refs/heads/karaf-4.4.x by this push:
     new 00c0d2ad0a Load the JLine terminal from the right classloader (#2193)
00c0d2ad0a is described below

commit 00c0d2ad0a4653203a904d064ba90e6827235936
Author: JB Onofré <[email protected]>
AuthorDate: Fri Dec 12 06:35:17 2025 +0100

    Load the JLine terminal from the right classloader (#2193)
---
 .../shell/impl/console/osgi/LocalConsoleManager.java    | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

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 49e5fe894a..440e05afea 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
@@ -60,10 +60,19 @@ public class LocalConsoleManager {
     }
 
     public void start() throws Exception {
-        final Terminal terminal = TerminalBuilder.builder()
-                .nativeSignals(true)
-                .signalHandler(Terminal.SignalHandler.SIG_IGN)
-                .build();
+        final Terminal terminal;
+
+        ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
+        try {
+            ClassLoader cl = TerminalBuilder.class.getClassLoader();
+            Thread.currentThread().setContextClassLoader(cl);
+            terminal = TerminalBuilder.builder()
+                    .nativeSignals(true)
+                    .signalHandler(Terminal.SignalHandler.SIG_IGN)
+                    .build();
+        } finally {
+            Thread.currentThread().setContextClassLoader(oldCl);
+        }
 
         final Subject subject = createLocalKarafSubject();    
         this.session = JaasHelper.doAs(subject, (PrivilegedAction<Session>) () 
-> {

Reply via email to