소스 검색

ZOOKEEPER-2074 Incorrect exit codes for "./zkCli.sh cmd arg" (surendra singh lilhore via michim)

git-svn-id: https://svn.apache.org/repos/asf/zookeeper/trunk@1658307 13f79535-47bb-0310-9956-ffa450edef68
Michi Mutsuzaki 10 년 전
부모
커밋
6edc5a35b4
2개의 변경된 파일10개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 0
      CHANGES.txt
  2. 7 3
      src/java/main/org/apache/zookeeper/ZooKeeperMain.java

+ 3 - 0
CHANGES.txt

@@ -31,6 +31,9 @@ BUGFIXES:
   ZOOKEEPER-1366 Zookeeper should be tolerant of clock adjustments (Hongchao
   Deng via michim)
 
+  ZOOKEEPER-2074 Incorrect exit codes for "./zkCli.sh cmd arg" (surendra singh
+  lilhore via michim)
+
 IMPROVEMENTS:
   ZOOKEEPER-1660 Documentation for Dynamic Reconfiguration (Reed Wanderman-Milne via shralex)  
 

+ 7 - 3
src/java/main/org/apache/zookeeper/ZooKeeperMain.java

@@ -273,7 +273,10 @@ public class ZooKeeperMain {
         throws KeeperException, IOException, InterruptedException
     {
         ZooKeeperMain main = new ZooKeeperMain(args);
-        main.run();
+        boolean result = main.run();
+        if (!result) {
+            System.exit(1);
+        }
     }
 
     public ZooKeeperMain(String args[]) throws IOException, InterruptedException {
@@ -288,7 +291,7 @@ public class ZooKeeperMain {
       this.zk = zk;
     }
 
-    void run() throws KeeperException, IOException, InterruptedException {
+    boolean run() throws KeeperException, IOException, InterruptedException {
         if (cl.getCommand() == null) {
             System.out.println("Welcome to ZooKeeper!");
 
@@ -342,9 +345,10 @@ public class ZooKeeperMain {
                     executeLine(line);
                 }
             }
+            return true;
         } else {
             // Command line args non-null.  Run what was passed.
-            processCmd(cl);
+            return processCmd(cl);
         }
     }