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

andor pushed a commit to branch branch-3.9
in repository https://gitbox.apache.org/repos/asf/zookeeper.git


The following commit(s) were added to refs/heads/branch-3.9 by this push:
     new ca501d869a ZOOKEEPER-5021: Exit from zkCli when interrupt (Ctrl-C) or 
EOF (Ctrl-D) is pressed
ca501d869a is described below

commit ca501d869a4d34445c3e79b9cc84d0a5aadd48d8
Author: Dávid Paksy <[email protected]>
AuthorDate: Thu Apr 9 02:21:42 2026 +0200

    ZOOKEEPER-5021: Exit from zkCli when interrupt (Ctrl-C) or EOF (Ctrl-D) is 
pressed
    
    Reviewers: ctubbsii, kezhuw
    Author: PDavid
    Closes #2369 from PDavid/ZOOKEEPER-5021-cli-fix-eof-interrupt-2
    
    (cherry picked from commit 6c4fabfd4726d9b576a1b8acba9b273696079339)
    Signed-off-by: Andor Molnar <[email protected]>
---
 .../src/main/java/org/apache/zookeeper/ZooKeeperMain.java         | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git 
a/zookeeper-server/src/main/java/org/apache/zookeeper/ZooKeeperMain.java 
b/zookeeper-server/src/main/java/org/apache/zookeeper/ZooKeeperMain.java
index ca27348e16..d5ffc20ca5 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/ZooKeeperMain.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/ZooKeeperMain.java
@@ -308,12 +308,13 @@ void run() throws IOException, InterruptedException {
         if (cl.getCommand() == null) {
             System.out.println("Welcome to ZooKeeper!");
 
-            boolean jlinemissing = false;
+            boolean jlinemissing = true;
             // only use jline if it's in the classpath
             try {
                 Class<?> readerC = 
Class.forName("org.jline.reader.LineReader");
                 Class<?> completerC = 
Class.forName("org.apache.zookeeper.JLineZNodeCompleter");
 
+                jlinemissing = false;
                 System.out.println("JLine support is enabled");
 
                 Object completer = 
completerC.getConstructor(ZooKeeper.class).newInstance(zk);
@@ -331,8 +332,9 @@ void run() throws IOException, InterruptedException {
                 | IllegalAccessException
                 | InstantiationException e
             ) {
-                LOG.debug("Unable to start jline", e);
-                jlinemissing = true;
+                if (jlinemissing) {
+                    LOG.debug("Unable to start jline", e);
+                }
             }
 
             if (jlinemissing) {

Reply via email to