Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exit batch files explictly using ERRORLEVEL #29583

Merged
merged 6 commits into from
Jan 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true

[*.bat]
indent_size = 2
2 changes: 2 additions & 0 deletions distribution/src/bin/elasticsearch-cli.bat
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ if defined ES_ADDITIONAL_CLASSPATH_DIRECTORIES (
-cp "%ES_CLASSPATH%" ^
"%ES_MAIN_CLASS%" ^
%*

exit /b %ERRORLEVEL%
4 changes: 3 additions & 1 deletion distribution/src/bin/elasticsearch-keystore.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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%
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
exit /b %ERRORLEVEL%

4 changes: 3 additions & 1 deletion distribution/src/bin/elasticsearch-node.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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%
5 changes: 4 additions & 1 deletion distribution/src/bin/elasticsearch-plugin.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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%
2 changes: 2 additions & 0 deletions distribution/src/bin/elasticsearch-service.bat
Original file line number Diff line number Diff line change
Expand Up @@ -258,3 +258,5 @@ goto:eof

endlocal
endlocal

exit /b %ERRORLEVEL%
4 changes: 3 additions & 1 deletion distribution/src/bin/elasticsearch-shard.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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%
1 change: 1 addition & 0 deletions distribution/src/bin/elasticsearch.bat
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,4 @@ cd /d "%ES_HOME%"

endlocal
endlocal
exit /b %ERRORLEVEL%
Original file line number Diff line number Diff line change
Expand Up @@ -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%
Original file line number Diff line number Diff line change
Expand Up @@ -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%
Original file line number Diff line number Diff line change
Expand Up @@ -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%
Original file line number Diff line number Diff line change
Expand Up @@ -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%
Original file line number Diff line number Diff line change
Expand Up @@ -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%
Original file line number Diff line number Diff line change
Expand Up @@ -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%
4 changes: 3 additions & 1 deletion x-pack/plugin/security/src/main/bin/elasticsearch-users.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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%
1 change: 1 addition & 0 deletions x-pack/plugin/sql/src/main/bin/elasticsearch-sql-cli.bat
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ set CLI_JAR=%ES_HOME%/bin/*

endlocal
endlocal
exit /b %ERRORLEVEL%
Original file line number Diff line number Diff line change
Expand Up @@ -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%