sodonnel commented on code in PR #7727:
URL: https://github.com/apache/ozone/pull/7727#discussion_r1930445929


##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/Shell.java:
##########
@@ -83,16 +93,31 @@ public void run(String[] argv) {
       // failure will be reported by regular, non-interactive run
     }
 
-    if (interactive) {
+    if (executionMode != null && (executionMode.interactive || 
!executionMode.command.isEmpty())) {
       spec.name(""); // use short name (e.g. "token get" instead of "ozone sh 
token get")
-      new REPL(this, getCmd(), (PicocliCommandsFactory) getCmd().getFactory());
+      installBatchExceptionHandler();
+      new REPL(this, getCmd(), (PicocliCommandsFactory) getCmd().getFactory(), 
executionMode.command);
     } else {
       TracingUtil.initTracing("shell", getOzoneConf());
       String spanName = spec.name() + " " + String.join(" ", argv);
       TracingUtil.executeInNewSpan(spanName, () -> super.run(argv));
     }
   }
 
+  private void installBatchExceptionHandler() {
+    // exit on first error in batch mode
+    if (!executionMode.interactive) {

Review Comment:
   Is this line correct so we only install the handler if it is NOT 
interactive? 
   
   Interactive=true is batch mode, right?



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to