sodonnel commented on code in PR #7727:
URL: https://github.com/apache/ozone/pull/7727#discussion_r1930607694
##########
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:
Ah, ok - thanks for clarifying. I missed that distinction between
interactive and batch.
--
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]