[2.x] fix: Fix sbt new argument parsing on Windows (#8509)

Only recombine split -- arguments after new/init command.

Fixes #7507
This commit is contained in:
MkDev11 2026-01-13 05:19:19 -05:00 committed by GitHub
parent d4570e3359
commit 28f7957307
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 27 additions and 0 deletions

View File

@ -547,6 +547,21 @@ if not "%g:~0,5%" == "-XX:+" if not "%g:~0,5%" == "-XX:-" if "%g:~0,3%" == "-XX"
)
)
if defined sbt_new if "%g:~0,2%" == "--" (
rem special handling for -- template arguments since '=' gets parsed away on Windows
for /F "tokens=1 delims==" %%a in ("%g%") do (
rem make sure it doesn't have the '=' already
if "%g%" == "%%a" (
if not "%~1" == "" (
call :dlog [args_loop] -- argument %~0=%~1
set "SBT_ARGS=!SBT_ARGS! %~0=%~1"
shift
goto args_loop
)
)
)
)
rem the %0 (instead of %~0) preserves original argument quoting
set SBT_ARGS=!SBT_ARGS! %0
@ -782,6 +797,18 @@ if not "%p:~0,5%" == "-XX:+" if not "%p:~0,5%" == "-XX:-" if "%p:~0,3%" == "-XX"
)
)
if defined sbt_new if "%p:~0,2%" == "--" (
rem special handling for -- template arguments since '=' gets parsed away on Windows
for /F "tokens=1 delims==" %%a in ("%p%") do (
rem make sure it doesn't have the '=' already
if "%p%" == "%%a" if not "%~1" == "" (
echo %0=%1
shift
goto echolist
)
)
)
if "%p:~0,14%" == "-agentlib:jdwp" (
rem special handling for --jvm-debug since '=' and ',' gets parsed away
for /F "tokens=1 delims==" %%a in ("%p%") do (