Skip to content

Commit

Permalink
Fixing Pinot Admin system exit logic (#7798)
Browse files Browse the repository at this point in the history
* Pinot admin only exits when the flag `pinot.admin.system.exit` is set and the sub-command status is not 0.

* address comments
  • Loading branch information
xiangfu0 committed Dec 12, 2021
1 parent 0e3b42d commit 2289e68
Showing 1 changed file with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,13 @@ public class PinotAdministrator {

@CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false,
description = "Print this message.")
boolean _help = false;
private boolean _help = false;

@CommandLine.Option(names = {"-version", "-v", "--v", "--version"}, required = false,
description = "Print the version of Pinot package.")
boolean _version = false;
private boolean _version = false;

int _status = 0;
private int _status = 1;

public void execute(String[] args) {
try {
Expand Down Expand Up @@ -190,13 +190,9 @@ public static void main(String[] args) {
PluginManager.get().init();
PinotAdministrator pinotAdministrator = new PinotAdministrator();
pinotAdministrator.execute(args);
// Ignore `pinot.admin.system.exit` property for Pinot quickstarts.
if ((args.length > 0) && ("quickstart".equalsIgnoreCase(args[0]))) {
return;
}
if (Boolean.parseBoolean(System.getProperties().getProperty("pinot.admin.system.exit"))) {
// If status is true, cmd was successfully, so return 0 from process.
System.exit(pinotAdministrator._status);
if ((pinotAdministrator._status != 0)
&& Boolean.parseBoolean(System.getProperties().getProperty("pinot.admin.system.exit"))) {
System.exit(pinotAdministrator._status);
}
}
}

0 comments on commit 2289e68

Please sign in to comment.