[2.x] fix: sbt.bat fails to start client/server mode on Windows (#9520)

sbt.bat fails to start in client/server mode on Windows, falling back to running the full JVM in the foreground.

sbtn uses CreateProcess to spawn the server process. The original %%20 path encoding doesn't work in batch delayed expansion context, and the default install path C:\Program Files (x86) contains spaces that CreateProcess splits at.
This commit is contained in:
Fabrizio Colonna 2026-07-28 00:58:39 +01:00 committed by GitHub
parent 67924298f2
commit d95b50d8e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 2 deletions

View File

@ -51,7 +51,7 @@ set sbt_args_allow_empty=
set sbt_args_sbt_dir= set sbt_args_sbt_dir=
set sbt_args_sbt_version= set sbt_args_sbt_version=
set sbt_args_mem= set sbt_args_mem=
set sbt_args_client= set sbt_args_client=-1
set sbt_args_jvm_client= set sbt_args_jvm_client=
set sbt_args_no_server= set sbt_args_no_server=
set sbt_args_experimental_execution_log= set sbt_args_experimental_execution_log=
@ -201,6 +201,14 @@ if defined _client_arg (
goto args_loop goto args_loop
) )
if "%~0" == "--server" set _server_arg=true
if defined _server_arg (
set _server_arg=
set sbt_args_client=0
goto args_loop
)
if "%~0" == "--jvm-client" set _jvm_client_arg=true if "%~0" == "--jvm-client" set _jvm_client_arg=true
if defined _jvm_client_arg ( if defined _jvm_client_arg (
@ -800,7 +808,7 @@ if defined sbt_args_verbose (
set "SBT_ARGS=-v !SBT_ARGS!" set "SBT_ARGS=-v !SBT_ARGS!"
) )
set "SBT_SCRIPT=!SBT_BIN_DIR: =%%20!sbt.bat" for %%I in ("!SBT_BIN_DIR!sbt.bat") do set "SBT_SCRIPT=%%~sI"
set "SBT_ARGS=--sbt-script=!SBT_SCRIPT! %SBT_ARGS%" set "SBT_ARGS=--sbt-script=!SBT_SCRIPT! %SBT_ARGS%"
rem Microsoft Visual C++ 2010 SP1 Redistributable Package (x64) is required rem Microsoft Visual C++ 2010 SP1 Redistributable Package (x64) is required