From af7ed1083129dd2f1eb8fbef2f45b49f394bc74b Mon Sep 17 00:00:00 2001 From: Mpdreamz Date: Wed, 18 Apr 2018 15:57:44 +0200 Subject: [PATCH 1/6] Exit batch files explictly using ERRORLEVEL This makes sure the exit code is preserved when calling the batch files from different contexts other than DOS Fixes #29582 This also fixes specific error codes being masked by an explict exit /b 1 causing the useful exitcodes from ExitCodes to be lost. --- distribution/src/bin/elasticsearch-cli.bat | 2 ++ distribution/src/bin/elasticsearch-keystore.bat | 6 +++--- distribution/src/bin/elasticsearch-plugin.bat | 7 ++++--- distribution/src/bin/elasticsearch-service.bat | 2 ++ distribution/src/bin/elasticsearch-shard.bat | 6 +++--- distribution/src/bin/elasticsearch.bat | 1 + .../plugin/security/src/main/bin/elasticsearch-certgen.bat | 6 +++--- .../security/src/main/bin/elasticsearch-certutil.bat | 6 +++--- .../plugin/security/src/main/bin/elasticsearch-migrate.bat | 6 +++--- .../security/src/main/bin/elasticsearch-saml-metadata.bat | 6 +++--- .../src/main/bin/elasticsearch-setup-passwords.bat | 6 +++--- .../security/src/main/bin/elasticsearch-syskeygen.bat | 6 +++--- .../plugin/security/src/main/bin/elasticsearch-users.bat | 6 +++--- x-pack/plugin/sql/src/main/bin/elasticsearch-sql-cli.bat | 1 + .../plugin/watcher/src/main/bin/elasticsearch-croneval.bat | 6 +++--- 15 files changed, 40 insertions(+), 33 deletions(-) diff --git a/distribution/src/bin/elasticsearch-cli.bat b/distribution/src/bin/elasticsearch-cli.bat index e17ade3b74af1..405f97ccc8dbf 100644 --- a/distribution/src/bin/elasticsearch-cli.bat +++ b/distribution/src/bin/elasticsearch-cli.bat @@ -21,3 +21,5 @@ if defined ES_ADDITIONAL_CLASSPATH_DIRECTORIES ( -cp "%ES_CLASSPATH%" ^ "%ES_MAIN_CLASS%" ^ %* + +exit /b %ERRORLEVEL% diff --git a/distribution/src/bin/elasticsearch-keystore.bat b/distribution/src/bin/elasticsearch-keystore.bat index b43182a273f6b..a55fcee471769 100644 --- a/distribution/src/bin/elasticsearch-keystore.bat +++ b/distribution/src/bin/elasticsearch-keystore.bat @@ -4,9 +4,9 @@ setlocal enabledelayedexpansion setlocal enableextensions set ES_MAIN_CLASS=org.elasticsearch.common.settings.KeyStoreCli -call "%~dp0elasticsearch-cli.bat" ^ - %%* ^ - || exit /b 1 +call "%~dp0elasticsearch-cli.bat" %%* || goto exit endlocal endlocal +:exit +exit /b %ERRORLEVEL% diff --git a/distribution/src/bin/elasticsearch-plugin.bat b/distribution/src/bin/elasticsearch-plugin.bat index 7e71de790f03e..3a7a72aefaaf8 100644 --- a/distribution/src/bin/elasticsearch-plugin.bat +++ b/distribution/src/bin/elasticsearch-plugin.bat @@ -5,9 +5,10 @@ setlocal enableextensions set ES_MAIN_CLASS=org.elasticsearch.plugins.PluginCli set ES_ADDITIONAL_CLASSPATH_DIRECTORIES=lib/tools/plugin-cli -call "%~dp0elasticsearch-cli.bat" ^ - %%* ^ - || exit /b 1 +call "%~dp0elasticsearch-cli.bat" %%* || goto exit + endlocal endlocal +:exit +exit /b %ERRORLEVEL% diff --git a/distribution/src/bin/elasticsearch-service.bat b/distribution/src/bin/elasticsearch-service.bat index f566c34c958ae..fc62c07ac9d3c 100644 --- a/distribution/src/bin/elasticsearch-service.bat +++ b/distribution/src/bin/elasticsearch-service.bat @@ -258,3 +258,5 @@ goto:eof endlocal endlocal + +exit /b %ERRORLEVEL% diff --git a/distribution/src/bin/elasticsearch-shard.bat b/distribution/src/bin/elasticsearch-shard.bat index e861b197e873d..6b9fde0c149aa 100644 --- a/distribution/src/bin/elasticsearch-shard.bat +++ b/distribution/src/bin/elasticsearch-shard.bat @@ -4,9 +4,9 @@ setlocal enabledelayedexpansion setlocal enableextensions set ES_MAIN_CLASS=org.elasticsearch.index.shard.ShardToolCli -call "%~dp0elasticsearch-cli.bat" ^ - %%* ^ - || exit /b 1 +call "%~dp0elasticsearch-cli.bat" %%* || goto exit endlocal endlocal +:exit +exit /b %ERRORLEVEL% diff --git a/distribution/src/bin/elasticsearch.bat b/distribution/src/bin/elasticsearch.bat index 6e268c9b13321..9b67fa2e0ffa6 100644 --- a/distribution/src/bin/elasticsearch.bat +++ b/distribution/src/bin/elasticsearch.bat @@ -55,3 +55,4 @@ cd /d "%ES_HOME%" endlocal endlocal +exit /b %ERRORLEVEL% diff --git a/x-pack/plugin/security/src/main/bin/elasticsearch-certgen.bat b/x-pack/plugin/security/src/main/bin/elasticsearch-certgen.bat index bb303f740e5c3..7f19b0c62e306 100644 --- a/x-pack/plugin/security/src/main/bin/elasticsearch-certgen.bat +++ b/x-pack/plugin/security/src/main/bin/elasticsearch-certgen.bat @@ -10,9 +10,9 @@ setlocal enableextensions set ES_MAIN_CLASS=org.elasticsearch.xpack.security.cli.CertificateGenerateTool set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-security-env set ES_ADDITIONAL_CLASSPATH_DIRECTORIES=lib/tools/security-cli -call "%~dp0elasticsearch-cli.bat" ^ - %%* ^ - || exit /b 1 +call "%~dp0elasticsearch-cli.bat" %%* || goto exit endlocal endlocal +:exit +exit /b %ERRORLEVEL% diff --git a/x-pack/plugin/security/src/main/bin/elasticsearch-certutil.bat b/x-pack/plugin/security/src/main/bin/elasticsearch-certutil.bat index 34f595824f82d..219686e2bdb0b 100644 --- a/x-pack/plugin/security/src/main/bin/elasticsearch-certutil.bat +++ b/x-pack/plugin/security/src/main/bin/elasticsearch-certutil.bat @@ -10,9 +10,9 @@ setlocal enableextensions set ES_MAIN_CLASS=org.elasticsearch.xpack.security.cli.CertificateTool set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-security-env set ES_ADDITIONAL_CLASSPATH_DIRECTORIES=lib/tools/security-cli -call "%~dp0elasticsearch-cli.bat" ^ - %%* ^ - || exit /b 1 +call "%~dp0elasticsearch-cli.bat" %%* || goto exit endlocal endlocal +:exit +exit /b %ERRORLEVEL% diff --git a/x-pack/plugin/security/src/main/bin/elasticsearch-migrate.bat b/x-pack/plugin/security/src/main/bin/elasticsearch-migrate.bat index 4b8e4f926d797..18c7eb68c62f3 100644 --- a/x-pack/plugin/security/src/main/bin/elasticsearch-migrate.bat +++ b/x-pack/plugin/security/src/main/bin/elasticsearch-migrate.bat @@ -9,9 +9,9 @@ setlocal enableextensions set ES_MAIN_CLASS=org.elasticsearch.xpack.security.authc.esnative.ESNativeRealmMigrateTool set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-security-env -call "%~dp0elasticsearch-cli.bat" ^ - %%* ^ - || exit /b 1 +call "%~dp0elasticsearch-cli.bat" %%* || goto exit endlocal endlocal +:exit +exit /b %ERRORLEVEL% diff --git a/x-pack/plugin/security/src/main/bin/elasticsearch-saml-metadata.bat b/x-pack/plugin/security/src/main/bin/elasticsearch-saml-metadata.bat index 64a272dfbb5a6..86dc471f948eb 100644 --- a/x-pack/plugin/security/src/main/bin/elasticsearch-saml-metadata.bat +++ b/x-pack/plugin/security/src/main/bin/elasticsearch-saml-metadata.bat @@ -9,9 +9,9 @@ setlocal enableextensions set ES_MAIN_CLASS=org.elasticsearch.xpack.security.authc.saml.SamlMetadataCommand set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-security-env -call "%~dp0elasticsearch-cli.bat" ^ - %%* ^ - || exit /b 1 +call "%~dp0elasticsearch-cli.bat" %%* || goto exit endlocal endlocal +:exit +exit /b %ERRORLEVEL% diff --git a/x-pack/plugin/security/src/main/bin/elasticsearch-setup-passwords.bat b/x-pack/plugin/security/src/main/bin/elasticsearch-setup-passwords.bat index 3c956ca47ba26..6a60b089aa827 100644 --- a/x-pack/plugin/security/src/main/bin/elasticsearch-setup-passwords.bat +++ b/x-pack/plugin/security/src/main/bin/elasticsearch-setup-passwords.bat @@ -9,9 +9,9 @@ setlocal enableextensions set ES_MAIN_CLASS=org.elasticsearch.xpack.security.authc.esnative.tool.SetupPasswordTool set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-security-env -call "%~dp0elasticsearch-cli.bat" ^ - %%* ^ - || exit /b 1 +call "%~dp0elasticsearch-cli.bat" %%* || goto exit endlocal endlocal +:exit +exit /b %ERRORLEVEL% diff --git a/x-pack/plugin/security/src/main/bin/elasticsearch-syskeygen.bat b/x-pack/plugin/security/src/main/bin/elasticsearch-syskeygen.bat index 11414872d073b..143d441334352 100644 --- a/x-pack/plugin/security/src/main/bin/elasticsearch-syskeygen.bat +++ b/x-pack/plugin/security/src/main/bin/elasticsearch-syskeygen.bat @@ -9,9 +9,9 @@ setlocal enableextensions set ES_MAIN_CLASS=org.elasticsearch.xpack.security.crypto.tool.SystemKeyTool set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-security-env -call "%~dp0elasticsearch-cli.bat" ^ - %%* ^ - || exit /b 1 +call "%~dp0elasticsearch-cli.bat" %%* || goto exit endlocal endlocal +:exit +exit /b %ERRORLEVEL% diff --git a/x-pack/plugin/security/src/main/bin/elasticsearch-users.bat b/x-pack/plugin/security/src/main/bin/elasticsearch-users.bat index 9b35895ed86c1..60f2b4f97f2fc 100644 --- a/x-pack/plugin/security/src/main/bin/elasticsearch-users.bat +++ b/x-pack/plugin/security/src/main/bin/elasticsearch-users.bat @@ -9,9 +9,9 @@ setlocal enableextensions set ES_MAIN_CLASS=org.elasticsearch.xpack.security.authc.file.tool.UsersTool set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-security-env -call "%~dp0elasticsearch-cli.bat" ^ - %%* ^ - || exit /b 1 +call "%~dp0elasticsearch-cli.bat" %%* || goto exit endlocal endlocal +:exit +exit /b %ERRORLEVEL% diff --git a/x-pack/plugin/sql/src/main/bin/elasticsearch-sql-cli.bat b/x-pack/plugin/sql/src/main/bin/elasticsearch-sql-cli.bat index cf159f0322363..48daf97b515ab 100644 --- a/x-pack/plugin/sql/src/main/bin/elasticsearch-sql-cli.bat +++ b/x-pack/plugin/sql/src/main/bin/elasticsearch-sql-cli.bat @@ -22,3 +22,4 @@ set CLI_JAR=%ES_HOME%/bin/* endlocal endlocal +exit /b %ERRORLEVEL% diff --git a/x-pack/plugin/watcher/src/main/bin/elasticsearch-croneval.bat b/x-pack/plugin/watcher/src/main/bin/elasticsearch-croneval.bat index 2b4a33c9f9e75..a8de19df4e4ae 100644 --- a/x-pack/plugin/watcher/src/main/bin/elasticsearch-croneval.bat +++ b/x-pack/plugin/watcher/src/main/bin/elasticsearch-croneval.bat @@ -9,9 +9,9 @@ setlocal enableextensions set ES_MAIN_CLASS=org.elasticsearch.xpack.watcher.trigger.schedule.tool.CronEvalTool set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-watcher-env -call "%~dp0elasticsearch-cli.bat" ^ - %%* ^ - || exit /b 1 +call "%~dp0elasticsearch-cli.bat" %%* || goto exit endlocal endlocal +:exit +exit /b %ERRORLEVEL% From d3d5a0adb9e3d4dc64bc80ad1c7ab9ae4fd08fd9 Mon Sep 17 00:00:00 2001 From: Mpdreamz Date: Tue, 8 Jan 2019 14:58:13 +0100 Subject: [PATCH 2/6] fix line breaks for calling cli to match the bash scripts --- distribution/src/bin/elasticsearch-keystore.bat | 4 +++- distribution/src/bin/elasticsearch-plugin.bat | 4 +++- distribution/src/bin/elasticsearch-shard.bat | 4 +++- x-pack/plugin/security/src/main/bin/elasticsearch-certgen.bat | 4 +++- .../plugin/security/src/main/bin/elasticsearch-certutil.bat | 4 +++- x-pack/plugin/security/src/main/bin/elasticsearch-migrate.bat | 4 +++- .../security/src/main/bin/elasticsearch-saml-metadata.bat | 4 +++- .../security/src/main/bin/elasticsearch-setup-passwords.bat | 4 +++- .../plugin/security/src/main/bin/elasticsearch-syskeygen.bat | 4 +++- x-pack/plugin/security/src/main/bin/elasticsearch-users.bat | 4 +++- x-pack/plugin/watcher/src/main/bin/elasticsearch-croneval.bat | 4 +++- 11 files changed, 33 insertions(+), 11 deletions(-) diff --git a/distribution/src/bin/elasticsearch-keystore.bat b/distribution/src/bin/elasticsearch-keystore.bat index a55fcee471769..71577757570cf 100644 --- a/distribution/src/bin/elasticsearch-keystore.bat +++ b/distribution/src/bin/elasticsearch-keystore.bat @@ -4,7 +4,9 @@ setlocal enabledelayedexpansion setlocal enableextensions set ES_MAIN_CLASS=org.elasticsearch.common.settings.KeyStoreCli -call "%~dp0elasticsearch-cli.bat" %%* || goto exit +call "%~dp0elasticsearch-cli.bat" ^ + %%* ^ + || goto exit endlocal endlocal diff --git a/distribution/src/bin/elasticsearch-plugin.bat b/distribution/src/bin/elasticsearch-plugin.bat index 3a7a72aefaaf8..6e7c295efa112 100644 --- a/distribution/src/bin/elasticsearch-plugin.bat +++ b/distribution/src/bin/elasticsearch-plugin.bat @@ -5,7 +5,9 @@ setlocal enableextensions set ES_MAIN_CLASS=org.elasticsearch.plugins.PluginCli set ES_ADDITIONAL_CLASSPATH_DIRECTORIES=lib/tools/plugin-cli -call "%~dp0elasticsearch-cli.bat" %%* || goto exit +call "%~dp0elasticsearch-cli.bat" ^ + %%* ^ + || goto exit endlocal diff --git a/distribution/src/bin/elasticsearch-shard.bat b/distribution/src/bin/elasticsearch-shard.bat index 6b9fde0c149aa..86f1b2c758f1d 100644 --- a/distribution/src/bin/elasticsearch-shard.bat +++ b/distribution/src/bin/elasticsearch-shard.bat @@ -4,7 +4,9 @@ setlocal enabledelayedexpansion setlocal enableextensions set ES_MAIN_CLASS=org.elasticsearch.index.shard.ShardToolCli -call "%~dp0elasticsearch-cli.bat" %%* || goto exit +call "%~dp0elasticsearch-cli.bat" ^ + %%* ^ + || goto exit endlocal endlocal diff --git a/x-pack/plugin/security/src/main/bin/elasticsearch-certgen.bat b/x-pack/plugin/security/src/main/bin/elasticsearch-certgen.bat index 7f19b0c62e306..bc72ba2cb9d0b 100644 --- a/x-pack/plugin/security/src/main/bin/elasticsearch-certgen.bat +++ b/x-pack/plugin/security/src/main/bin/elasticsearch-certgen.bat @@ -10,7 +10,9 @@ setlocal enableextensions set ES_MAIN_CLASS=org.elasticsearch.xpack.security.cli.CertificateGenerateTool set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-security-env set ES_ADDITIONAL_CLASSPATH_DIRECTORIES=lib/tools/security-cli -call "%~dp0elasticsearch-cli.bat" %%* || goto exit +call "%~dp0elasticsearch-cli.bat" ^ + %%* ^ + || goto exit endlocal endlocal diff --git a/x-pack/plugin/security/src/main/bin/elasticsearch-certutil.bat b/x-pack/plugin/security/src/main/bin/elasticsearch-certutil.bat index 219686e2bdb0b..408903b410ff6 100644 --- a/x-pack/plugin/security/src/main/bin/elasticsearch-certutil.bat +++ b/x-pack/plugin/security/src/main/bin/elasticsearch-certutil.bat @@ -10,7 +10,9 @@ setlocal enableextensions set ES_MAIN_CLASS=org.elasticsearch.xpack.security.cli.CertificateTool set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-security-env set ES_ADDITIONAL_CLASSPATH_DIRECTORIES=lib/tools/security-cli -call "%~dp0elasticsearch-cli.bat" %%* || goto exit +call "%~dp0elasticsearch-cli.bat" ^ + %%* ^ + || goto exit endlocal endlocal diff --git a/x-pack/plugin/security/src/main/bin/elasticsearch-migrate.bat b/x-pack/plugin/security/src/main/bin/elasticsearch-migrate.bat index 18c7eb68c62f3..c261d583dca76 100644 --- a/x-pack/plugin/security/src/main/bin/elasticsearch-migrate.bat +++ b/x-pack/plugin/security/src/main/bin/elasticsearch-migrate.bat @@ -9,7 +9,9 @@ setlocal enableextensions set ES_MAIN_CLASS=org.elasticsearch.xpack.security.authc.esnative.ESNativeRealmMigrateTool set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-security-env -call "%~dp0elasticsearch-cli.bat" %%* || goto exit +call "%~dp0elasticsearch-cli.bat" ^ + %%* ^ + || goto exit endlocal endlocal diff --git a/x-pack/plugin/security/src/main/bin/elasticsearch-saml-metadata.bat b/x-pack/plugin/security/src/main/bin/elasticsearch-saml-metadata.bat index 86dc471f948eb..c4c1c087e4a39 100644 --- a/x-pack/plugin/security/src/main/bin/elasticsearch-saml-metadata.bat +++ b/x-pack/plugin/security/src/main/bin/elasticsearch-saml-metadata.bat @@ -9,7 +9,9 @@ setlocal enableextensions set ES_MAIN_CLASS=org.elasticsearch.xpack.security.authc.saml.SamlMetadataCommand set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-security-env -call "%~dp0elasticsearch-cli.bat" %%* || goto exit +call "%~dp0elasticsearch-cli.bat" ^ + %%* ^ + || goto exit endlocal endlocal diff --git a/x-pack/plugin/security/src/main/bin/elasticsearch-setup-passwords.bat b/x-pack/plugin/security/src/main/bin/elasticsearch-setup-passwords.bat index 6a60b089aa827..a0e8103394cc6 100644 --- a/x-pack/plugin/security/src/main/bin/elasticsearch-setup-passwords.bat +++ b/x-pack/plugin/security/src/main/bin/elasticsearch-setup-passwords.bat @@ -9,7 +9,9 @@ setlocal enableextensions set ES_MAIN_CLASS=org.elasticsearch.xpack.security.authc.esnative.tool.SetupPasswordTool set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-security-env -call "%~dp0elasticsearch-cli.bat" %%* || goto exit +call "%~dp0elasticsearch-cli.bat" ^ + %%* ^ + || goto exit endlocal endlocal diff --git a/x-pack/plugin/security/src/main/bin/elasticsearch-syskeygen.bat b/x-pack/plugin/security/src/main/bin/elasticsearch-syskeygen.bat index 143d441334352..fa5514fd8a819 100644 --- a/x-pack/plugin/security/src/main/bin/elasticsearch-syskeygen.bat +++ b/x-pack/plugin/security/src/main/bin/elasticsearch-syskeygen.bat @@ -9,7 +9,9 @@ setlocal enableextensions set ES_MAIN_CLASS=org.elasticsearch.xpack.security.crypto.tool.SystemKeyTool set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-security-env -call "%~dp0elasticsearch-cli.bat" %%* || goto exit +call "%~dp0elasticsearch-cli.bat" ^ + %%* ^ + || goto exit endlocal endlocal diff --git a/x-pack/plugin/security/src/main/bin/elasticsearch-users.bat b/x-pack/plugin/security/src/main/bin/elasticsearch-users.bat index 60f2b4f97f2fc..858732184e949 100644 --- a/x-pack/plugin/security/src/main/bin/elasticsearch-users.bat +++ b/x-pack/plugin/security/src/main/bin/elasticsearch-users.bat @@ -9,7 +9,9 @@ setlocal enableextensions set ES_MAIN_CLASS=org.elasticsearch.xpack.security.authc.file.tool.UsersTool set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-security-env -call "%~dp0elasticsearch-cli.bat" %%* || goto exit +call "%~dp0elasticsearch-cli.bat" ^ + %%* ^ + || goto exit endlocal endlocal diff --git a/x-pack/plugin/watcher/src/main/bin/elasticsearch-croneval.bat b/x-pack/plugin/watcher/src/main/bin/elasticsearch-croneval.bat index a8de19df4e4ae..d47305811928a 100644 --- a/x-pack/plugin/watcher/src/main/bin/elasticsearch-croneval.bat +++ b/x-pack/plugin/watcher/src/main/bin/elasticsearch-croneval.bat @@ -9,7 +9,9 @@ setlocal enableextensions set ES_MAIN_CLASS=org.elasticsearch.xpack.watcher.trigger.schedule.tool.CronEvalTool set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-watcher-env -call "%~dp0elasticsearch-cli.bat" %%* || goto exit +call "%~dp0elasticsearch-cli.bat" ^ + %%* ^ + || goto exit endlocal endlocal From 10314090de94d368e8b3f2b10bb9eadbee05ae37 Mon Sep 17 00:00:00 2001 From: Mpdreamz Date: Tue, 8 Jan 2019 15:07:28 +0100 Subject: [PATCH 3/6] indent size of bash files is 2, make sure editorconfig does the same for bat files --- .editorconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.editorconfig b/.editorconfig index 9d4bfbf55d3a1..c3a32bede3261 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,3 +8,6 @@ indent_style = space indent_size = 4 trim_trailing_whitespace = true insert_final_newline = true + +[*.bat] +indent_size = 2 From 03a2733c4a81bbc20a1157ee19b3736ba163b971 Mon Sep 17 00:00:00 2001 From: Mpdreamz Date: Tue, 8 Jan 2019 15:07:50 +0100 Subject: [PATCH 4/6] update indenting to match bash files --- distribution/src/bin/elasticsearch-plugin.bat | 4 ++-- distribution/src/bin/elasticsearch-shard.bat | 4 ++-- x-pack/plugin/security/src/main/bin/elasticsearch-certgen.bat | 4 ++-- .../plugin/security/src/main/bin/elasticsearch-certutil.bat | 4 ++-- x-pack/plugin/security/src/main/bin/elasticsearch-migrate.bat | 4 ++-- .../security/src/main/bin/elasticsearch-saml-metadata.bat | 4 ++-- .../security/src/main/bin/elasticsearch-setup-passwords.bat | 4 ++-- .../plugin/security/src/main/bin/elasticsearch-syskeygen.bat | 4 ++-- x-pack/plugin/security/src/main/bin/elasticsearch-users.bat | 4 ++-- x-pack/plugin/watcher/src/main/bin/elasticsearch-croneval.bat | 4 ++-- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/distribution/src/bin/elasticsearch-plugin.bat b/distribution/src/bin/elasticsearch-plugin.bat index 6e7c295efa112..e447c7e847cf2 100644 --- a/distribution/src/bin/elasticsearch-plugin.bat +++ b/distribution/src/bin/elasticsearch-plugin.bat @@ -6,8 +6,8 @@ setlocal enableextensions set ES_MAIN_CLASS=org.elasticsearch.plugins.PluginCli set ES_ADDITIONAL_CLASSPATH_DIRECTORIES=lib/tools/plugin-cli call "%~dp0elasticsearch-cli.bat" ^ - %%* ^ - || goto exit + %%* ^ + || goto exit endlocal diff --git a/distribution/src/bin/elasticsearch-shard.bat b/distribution/src/bin/elasticsearch-shard.bat index 86f1b2c758f1d..4db48f141fd6c 100644 --- a/distribution/src/bin/elasticsearch-shard.bat +++ b/distribution/src/bin/elasticsearch-shard.bat @@ -5,8 +5,8 @@ setlocal enableextensions set ES_MAIN_CLASS=org.elasticsearch.index.shard.ShardToolCli call "%~dp0elasticsearch-cli.bat" ^ - %%* ^ - || goto exit + %%* ^ + || goto exit endlocal endlocal diff --git a/x-pack/plugin/security/src/main/bin/elasticsearch-certgen.bat b/x-pack/plugin/security/src/main/bin/elasticsearch-certgen.bat index bc72ba2cb9d0b..d268ea04290dd 100644 --- a/x-pack/plugin/security/src/main/bin/elasticsearch-certgen.bat +++ b/x-pack/plugin/security/src/main/bin/elasticsearch-certgen.bat @@ -11,8 +11,8 @@ set ES_MAIN_CLASS=org.elasticsearch.xpack.security.cli.CertificateGenerateTool set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-security-env set ES_ADDITIONAL_CLASSPATH_DIRECTORIES=lib/tools/security-cli call "%~dp0elasticsearch-cli.bat" ^ - %%* ^ - || goto exit + %%* ^ + || goto exit endlocal endlocal diff --git a/x-pack/plugin/security/src/main/bin/elasticsearch-certutil.bat b/x-pack/plugin/security/src/main/bin/elasticsearch-certutil.bat index 408903b410ff6..40dc4f5c29b4f 100644 --- a/x-pack/plugin/security/src/main/bin/elasticsearch-certutil.bat +++ b/x-pack/plugin/security/src/main/bin/elasticsearch-certutil.bat @@ -11,8 +11,8 @@ set ES_MAIN_CLASS=org.elasticsearch.xpack.security.cli.CertificateTool set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-security-env set ES_ADDITIONAL_CLASSPATH_DIRECTORIES=lib/tools/security-cli call "%~dp0elasticsearch-cli.bat" ^ - %%* ^ - || goto exit + %%* ^ + || goto exit endlocal endlocal diff --git a/x-pack/plugin/security/src/main/bin/elasticsearch-migrate.bat b/x-pack/plugin/security/src/main/bin/elasticsearch-migrate.bat index c261d583dca76..a50bc1a384ed0 100644 --- a/x-pack/plugin/security/src/main/bin/elasticsearch-migrate.bat +++ b/x-pack/plugin/security/src/main/bin/elasticsearch-migrate.bat @@ -10,8 +10,8 @@ setlocal enableextensions set ES_MAIN_CLASS=org.elasticsearch.xpack.security.authc.esnative.ESNativeRealmMigrateTool set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-security-env call "%~dp0elasticsearch-cli.bat" ^ - %%* ^ - || goto exit + %%* ^ + || goto exit endlocal endlocal diff --git a/x-pack/plugin/security/src/main/bin/elasticsearch-saml-metadata.bat b/x-pack/plugin/security/src/main/bin/elasticsearch-saml-metadata.bat index c4c1c087e4a39..f39aedaff02e0 100644 --- a/x-pack/plugin/security/src/main/bin/elasticsearch-saml-metadata.bat +++ b/x-pack/plugin/security/src/main/bin/elasticsearch-saml-metadata.bat @@ -10,8 +10,8 @@ setlocal enableextensions set ES_MAIN_CLASS=org.elasticsearch.xpack.security.authc.saml.SamlMetadataCommand set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-security-env call "%~dp0elasticsearch-cli.bat" ^ - %%* ^ - || goto exit + %%* ^ + || goto exit endlocal endlocal diff --git a/x-pack/plugin/security/src/main/bin/elasticsearch-setup-passwords.bat b/x-pack/plugin/security/src/main/bin/elasticsearch-setup-passwords.bat index a0e8103394cc6..b650fcf84830f 100644 --- a/x-pack/plugin/security/src/main/bin/elasticsearch-setup-passwords.bat +++ b/x-pack/plugin/security/src/main/bin/elasticsearch-setup-passwords.bat @@ -10,8 +10,8 @@ setlocal enableextensions set ES_MAIN_CLASS=org.elasticsearch.xpack.security.authc.esnative.tool.SetupPasswordTool set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-security-env call "%~dp0elasticsearch-cli.bat" ^ - %%* ^ - || goto exit + %%* ^ + || goto exit endlocal endlocal diff --git a/x-pack/plugin/security/src/main/bin/elasticsearch-syskeygen.bat b/x-pack/plugin/security/src/main/bin/elasticsearch-syskeygen.bat index fa5514fd8a819..31fc871a5f7d0 100644 --- a/x-pack/plugin/security/src/main/bin/elasticsearch-syskeygen.bat +++ b/x-pack/plugin/security/src/main/bin/elasticsearch-syskeygen.bat @@ -10,8 +10,8 @@ setlocal enableextensions set ES_MAIN_CLASS=org.elasticsearch.xpack.security.crypto.tool.SystemKeyTool set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-security-env call "%~dp0elasticsearch-cli.bat" ^ - %%* ^ - || goto exit + %%* ^ + || goto exit endlocal endlocal diff --git a/x-pack/plugin/security/src/main/bin/elasticsearch-users.bat b/x-pack/plugin/security/src/main/bin/elasticsearch-users.bat index 858732184e949..b2600adfad282 100644 --- a/x-pack/plugin/security/src/main/bin/elasticsearch-users.bat +++ b/x-pack/plugin/security/src/main/bin/elasticsearch-users.bat @@ -10,8 +10,8 @@ setlocal enableextensions set ES_MAIN_CLASS=org.elasticsearch.xpack.security.authc.file.tool.UsersTool set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-security-env call "%~dp0elasticsearch-cli.bat" ^ - %%* ^ - || goto exit + %%* ^ + || goto exit endlocal endlocal diff --git a/x-pack/plugin/watcher/src/main/bin/elasticsearch-croneval.bat b/x-pack/plugin/watcher/src/main/bin/elasticsearch-croneval.bat index d47305811928a..571c19056bb96 100644 --- a/x-pack/plugin/watcher/src/main/bin/elasticsearch-croneval.bat +++ b/x-pack/plugin/watcher/src/main/bin/elasticsearch-croneval.bat @@ -10,8 +10,8 @@ setlocal enableextensions set ES_MAIN_CLASS=org.elasticsearch.xpack.watcher.trigger.schedule.tool.CronEvalTool set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-watcher-env call "%~dp0elasticsearch-cli.bat" ^ - %%* ^ - || goto exit + %%* ^ + || goto exit endlocal endlocal From 00ebdeedd0d51a28f84f33b01bf4d0dac8aaec9b Mon Sep 17 00:00:00 2001 From: Mpdreamz Date: Tue, 8 Jan 2019 15:10:48 +0100 Subject: [PATCH 5/6] update elasticsearch-keystore.bat indenting --- distribution/src/bin/elasticsearch-keystore.bat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/distribution/src/bin/elasticsearch-keystore.bat b/distribution/src/bin/elasticsearch-keystore.bat index 71577757570cf..83372248fb61a 100644 --- a/distribution/src/bin/elasticsearch-keystore.bat +++ b/distribution/src/bin/elasticsearch-keystore.bat @@ -5,8 +5,8 @@ setlocal enableextensions set ES_MAIN_CLASS=org.elasticsearch.common.settings.KeyStoreCli call "%~dp0elasticsearch-cli.bat" ^ - %%* ^ - || goto exit + %%* ^ + || goto exit endlocal endlocal From 94d31bc767a04439ae039f6efe7b307c75f60bad Mon Sep 17 00:00:00 2001 From: Mpdreamz Date: Fri, 25 Jan 2019 16:27:28 +0100 Subject: [PATCH 6/6] Update elasticsearch-node.bat to exit outside of endlocal --- distribution/src/bin/elasticsearch-node.bat | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/distribution/src/bin/elasticsearch-node.bat b/distribution/src/bin/elasticsearch-node.bat index 264a357cb8af4..b152331d5ef89 100644 --- a/distribution/src/bin/elasticsearch-node.bat +++ b/distribution/src/bin/elasticsearch-node.bat @@ -6,7 +6,9 @@ setlocal enableextensions set ES_MAIN_CLASS=org.elasticsearch.cluster.coordination.NodeToolCli call "%~dp0elasticsearch-cli.bat" ^ %%* ^ - || exit /b 1 + || goto exit endlocal endlocal +:exit +exit /b %ERRORLEVEL%