Skip to content

Commit

Permalink
Fix argument parsing for -D options with multiple values on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
malliaridis committed Dec 14, 2024
1 parent 024f973 commit f0acc39
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions solr/bin/solr.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -643,15 +643,36 @@ SHIFT
goto parse_args

:set_passthru
set "PASSTHRU=%~1=%~2"
set "PASSTHRU_KEY=%~1"
set "PASSTHRU_VALUES="

SHIFT
:repeat_passthru
set "arg=%~1"
if "%arg%"=="" goto end_passthru
set firstChar=%arg:~0,1%
IF "%firstChar%"=="-" (
goto end_passthru
)

if defined PASSTHRU_VALUES (
set "PASSTHRU_VALUES=%PASSTHRU_VALUES%,%arg%"
) else (
set "PASSTHRU_VALUES=%arg%"
)
SHIFT
goto repeat_passthru

:end_passthru
set "PASSTHRU=%PASSTHRU_KEY%=%PASSTHRU_VALUES%"

IF NOT "%SOLR_OPTS%"=="" (
set "SOLR_OPTS=%SOLR_OPTS% %PASSTHRU%"
) ELSE (
set "SOLR_OPTS=%PASSTHRU%"
)
set "PASS_TO_RUN_EXAMPLE=%PASSTHRU% !PASS_TO_RUN_EXAMPLE!"
SHIFT
SHIFT

goto parse_args

:set_noprompt
Expand Down

0 comments on commit f0acc39

Please sign in to comment.