jiahuili430 commented on code in PR #4835:
URL: https://github.com/apache/couchdb/pull/4835#discussion_r1390458823


##########
dev/run:
##########
@@ -504,6 +512,119 @@ def boot_nouveau(ctx):
     )
 
 
+CLOUSEAU_DIR = "clouseau"
+JAVA_VERSION_RE = re.compile('"(\d+\.\d+).*"')
+
+
+def get_java_version(java):
+    output = sp.check_output([java, "-version"], 
stderr=sp.STDOUT).decode("utf-8")
+    if output:
+        matches = JAVA_VERSION_RE.search(output)
+        if matches:
+            return float(matches.groups()[0])
+
+
+@log("Start Clouseau node clouseau{idx}")
+def boot_clouseau(ctx, idx):
+    def warn(reason):
+        print("Warning: " + reason)

Review Comment:
   Instead of multiple `return` in the following if statements, shall we add 
`sys.exit()` after this line?
   
   - If we use `return` the log looks like this and never stops until we 
terminate it manually.
   ```bash
   [ * ] Setup environment ... ok
   [ * ] Ensure CouchDB is built ... ok
   [ * ] Ensure Erlang boot script exists ... ok
   [ * ] Prepare configuration files ... ok
   [ * ] Start node node1 ... ok
   [ * ] Start Clouseau node clouseau1 ... Warning: Clouseau deployment cannot 
be found, please run `./configure with --enable-clouseau`
   ok
   [ * ] Check node at http://127.0.0.1:15984/ ... ok
   [ * ] Check Clouseau node clouseau1 ... failed: Clouseau is not working
   [ * ] Check node at http://127.0.0.1:15984/ ... ok
   [ * ] Check Clouseau node clouseau1 ... failed: Clouseau is not working
   [ * ] Check node at http://127.0.0.1:15984/ ... ok
   ...
   ```
   - If we use `sys.exit()` it will stop immediately after the warning.
   ```bash
   [ * ] Setup environment ... ok
   [ * ] Ensure CouchDB is built ... ok
   [ * ] Ensure Erlang boot script exists ... ok
   [ * ] Prepare configuration files ... ok
   [ * ] Start node node1 ... ok
   [ * ] Start Clouseau node clouseau1 ...
   Warning: Clouseau deployment cannot be found, please run `./configure 
--enable-clouseau`
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to