logstash/bin/logstash.bat
Rob Bavey 59c5374849
Fix windows scripts to also pull settings from JvmOptionsParser (#14355)
* Fix windows scripts to also pull settings from JvmOptionsParser

Prior to this commit, the windows version of the keystore and plugin scripts
diverged from the bash version of these scripts, as they did not pick up Jvm Options
from the JvmOptionsParser, leading to certain mandatory settings not being picked up,
breaking compatibility with Windows on certain versions of the JDK. This PR ensures
that these scripts also use the JvmOptionsParser.

This does not resolve the issue described in #14176, which will be looked at in a future
PR

Relates: #14354

* Add goto :eof as per code review suggestion
2022-07-18 09:03:40 -04:00

46 lines
1.2 KiB
Batchfile

@echo off
setlocal enabledelayedexpansion
set params='%*'
if "%1" == "-V" goto version
if "%1" == "--version" goto version
call "%~dp0setup.bat" || exit /b 1
if errorlevel 1 (
if not defined nopauseonerror (
pause
)
exit /B %ERRORLEVEL%
)
"%JAVACMD%" %JAVA_OPTS% -cp "%CLASSPATH%" org.logstash.Logstash %*
goto :end
:version
set LOGSTASH_VERSION_FILE1="%LS_HOME%\logstash-core\versions-gem-copy.yml"
set LOGSTASH_VERSION_FILE2="%LS_HOME%\versions.yml"
set "LOGSTASH_VERSION=Version not detected"
if exist !LOGSTASH_VERSION_FILE1! (
rem this file is present in zip, deb and rpm artifacts and after bundle install
rem but might not be for a git checkout type install
for /F "tokens=1,2 delims=: " %%a in ('type !LOGSTASH_VERSION_FILE1!') do (
if "%%a"=="logstash" set LOGSTASH_VERSION=%%b
)
) else (
if exist !LOGSTASH_VERSION_FILE2! (
rem this file is present for a git checkout type install
rem but its not in zip, deb and rpm artifacts (and in integration tests)
for /F "tokens=1,2 delims=: " %%a in ('type !LOGSTASH_VERSION_FILE2!') do (
if "%%a"=="logstash" set LOGSTASH_VERSION=%%b
)
)
)
echo logstash !LOGSTASH_VERSION!
goto :end
:end
endlocal
exit /B %ERRORLEVEL%