Exit batch files explictly using ERRORLEVEL (#29583)
* 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. * fix line breaks for calling cli to match the bash scripts * indent size of bash files is 2, make sure editorconfig does the same for bat files * update indenting to match bash files * update elasticsearch-keystore.bat indenting * Update elasticsearch-node.bat to exit outside of endlocal
This commit is contained in:
parent
f1f54e0f61
commit
dfecb256cb
|
@ -8,3 +8,6 @@ indent_style = space
|
|||
indent_size = 4
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.bat]
|
||||
indent_size = 2
|
||||
|
|
|
@ -21,3 +21,5 @@ if defined ES_ADDITIONAL_CLASSPATH_DIRECTORIES (
|
|||
-cp "%ES_CLASSPATH%" ^
|
||||
"%ES_MAIN_CLASS%" ^
|
||||
%*
|
||||
|
||||
exit /b %ERRORLEVEL%
|
||||
|
|
|
@ -6,7 +6,9 @@ setlocal enableextensions
|
|||
set ES_MAIN_CLASS=org.elasticsearch.common.settings.KeyStoreCli
|
||||
call "%~dp0elasticsearch-cli.bat" ^
|
||||
%%* ^
|
||||
|| exit /b 1
|
||||
|| goto exit
|
||||
|
||||
endlocal
|
||||
endlocal
|
||||
:exit
|
||||
exit /b %ERRORLEVEL%
|
||||
|
|
|
@ -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%
|
||||
|
|
|
@ -7,7 +7,10 @@ set ES_MAIN_CLASS=org.elasticsearch.plugins.PluginCli
|
|||
set ES_ADDITIONAL_CLASSPATH_DIRECTORIES=lib/tools/plugin-cli
|
||||
call "%~dp0elasticsearch-cli.bat" ^
|
||||
%%* ^
|
||||
|| exit /b 1
|
||||
|| goto exit
|
||||
|
||||
|
||||
endlocal
|
||||
endlocal
|
||||
:exit
|
||||
exit /b %ERRORLEVEL%
|
||||
|
|
|
@ -258,3 +258,5 @@ goto:eof
|
|||
|
||||
endlocal
|
||||
endlocal
|
||||
|
||||
exit /b %ERRORLEVEL%
|
||||
|
|
|
@ -6,7 +6,9 @@ setlocal enableextensions
|
|||
set ES_MAIN_CLASS=org.elasticsearch.index.shard.ShardToolCli
|
||||
call "%~dp0elasticsearch-cli.bat" ^
|
||||
%%* ^
|
||||
|| exit /b 1
|
||||
|| goto exit
|
||||
|
||||
endlocal
|
||||
endlocal
|
||||
:exit
|
||||
exit /b %ERRORLEVEL%
|
||||
|
|
|
@ -55,3 +55,4 @@ cd /d "%ES_HOME%"
|
|||
|
||||
endlocal
|
||||
endlocal
|
||||
exit /b %ERRORLEVEL%
|
||||
|
|
|
@ -12,7 +12,9 @@ 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
|
||||
|| goto exit
|
||||
|
||||
endlocal
|
||||
endlocal
|
||||
:exit
|
||||
exit /b %ERRORLEVEL%
|
||||
|
|
|
@ -12,7 +12,9 @@ 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
|
||||
|| goto exit
|
||||
|
||||
endlocal
|
||||
endlocal
|
||||
:exit
|
||||
exit /b %ERRORLEVEL%
|
||||
|
|
|
@ -11,7 +11,9 @@ set ES_MAIN_CLASS=org.elasticsearch.xpack.security.authc.esnative.ESNativeRealmM
|
|||
set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-security-env
|
||||
call "%~dp0elasticsearch-cli.bat" ^
|
||||
%%* ^
|
||||
|| exit /b 1
|
||||
|| goto exit
|
||||
|
||||
endlocal
|
||||
endlocal
|
||||
:exit
|
||||
exit /b %ERRORLEVEL%
|
||||
|
|
|
@ -11,7 +11,9 @@ set ES_MAIN_CLASS=org.elasticsearch.xpack.security.authc.saml.SamlMetadataComman
|
|||
set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-security-env
|
||||
call "%~dp0elasticsearch-cli.bat" ^
|
||||
%%* ^
|
||||
|| exit /b 1
|
||||
|| goto exit
|
||||
|
||||
endlocal
|
||||
endlocal
|
||||
:exit
|
||||
exit /b %ERRORLEVEL%
|
||||
|
|
|
@ -11,7 +11,9 @@ set ES_MAIN_CLASS=org.elasticsearch.xpack.security.authc.esnative.tool.SetupPass
|
|||
set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-security-env
|
||||
call "%~dp0elasticsearch-cli.bat" ^
|
||||
%%* ^
|
||||
|| exit /b 1
|
||||
|| goto exit
|
||||
|
||||
endlocal
|
||||
endlocal
|
||||
:exit
|
||||
exit /b %ERRORLEVEL%
|
||||
|
|
|
@ -11,7 +11,9 @@ 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
|
||||
|| goto exit
|
||||
|
||||
endlocal
|
||||
endlocal
|
||||
:exit
|
||||
exit /b %ERRORLEVEL%
|
||||
|
|
|
@ -11,7 +11,9 @@ 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
|
||||
|| goto exit
|
||||
|
||||
endlocal
|
||||
endlocal
|
||||
:exit
|
||||
exit /b %ERRORLEVEL%
|
||||
|
|
|
@ -22,3 +22,4 @@ set CLI_JAR=%ES_HOME%/bin/*
|
|||
|
||||
endlocal
|
||||
endlocal
|
||||
exit /b %ERRORLEVEL%
|
||||
|
|
|
@ -11,7 +11,9 @@ set ES_MAIN_CLASS=org.elasticsearch.xpack.watcher.trigger.schedule.tool.CronEval
|
|||
set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-watcher-env
|
||||
call "%~dp0elasticsearch-cli.bat" ^
|
||||
%%* ^
|
||||
|| exit /b 1
|
||||
|| goto exit
|
||||
|
||||
endlocal
|
||||
endlocal
|
||||
:exit
|
||||
exit /b %ERRORLEVEL%
|
||||
|
|
Loading…
Reference in New Issue