sodonnel commented on code in PR #7727: URL: https://github.com/apache/ozone/pull/7727#discussion_r1930625621
########## 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: I see it now - the `--interactive` switch is not needed if you pass one or more `--execute` switches. Interactive puts you into a kind of shell. I mis-understood and thought it was ozone `sh --interactive --execute 'volume create /vol1' ... `. Makes sense now. -- 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: issues-unsubscr...@ozone.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@ozone.apache.org For additional commands, e-mail: issues-h...@ozone.apache.org