From f2aca1e9bc3b4d73d75666d32cf196c36c68815c Mon Sep 17 00:00:00 2001 From: javanna Date: Fri, 10 Oct 2014 14:40:42 +0200 Subject: [PATCH] Cli tools: make sure that the status code is returned from scripts The status code wasn't returned from java mains (always 0), also it got lost anyway within our scripts that are calling the java mains. Relates to elastic/elasticsearch#142 Original commit: elastic/x-pack-elasticsearch@db6248660557b0b8d6525ee039c1302d27e54e25 --- .../elasticsearch/shield/authc/esusers/tool/ESUsersTool.java | 3 ++- .../java/org/elasticsearch/shield/key/tool/SystemKeyTool.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/elasticsearch/shield/authc/esusers/tool/ESUsersTool.java b/src/main/java/org/elasticsearch/shield/authc/esusers/tool/ESUsersTool.java index c9769dcf062..9bf61e424d7 100644 --- a/src/main/java/org/elasticsearch/shield/authc/esusers/tool/ESUsersTool.java +++ b/src/main/java/org/elasticsearch/shield/authc/esusers/tool/ESUsersTool.java @@ -40,7 +40,8 @@ public class ESUsersTool extends CliTool { .build(); public static void main(String[] args) { - new ESUsersTool().execute(args); + int status = new ESUsersTool().execute(args); + System.exit(status); } public ESUsersTool() { diff --git a/src/main/java/org/elasticsearch/shield/key/tool/SystemKeyTool.java b/src/main/java/org/elasticsearch/shield/key/tool/SystemKeyTool.java index 1a222169771..2e994613793 100644 --- a/src/main/java/org/elasticsearch/shield/key/tool/SystemKeyTool.java +++ b/src/main/java/org/elasticsearch/shield/key/tool/SystemKeyTool.java @@ -27,7 +27,8 @@ import static org.elasticsearch.common.cli.CliToolConfig.config; public class SystemKeyTool extends CliTool { public static void main(String[] args) throws Exception { - new SystemKeyTool().execute(args); + int status = new SystemKeyTool().execute(args); + System.exit(status); } private static final CliToolConfig CONFIG = config("syskey", SystemKeyTool.class)