fix: Read build.properties directly in --version handler to avoid hangs (#8717)

Instead of relying on the early build_props_sbt_version read, read
build.properties directly in the --version handler using a local
variable. This isolates file I/O to only when --version is called and
avoids potential interference with normal script execution that could
cause Windows test hangs.
This commit is contained in:
Eruis2579 2026-02-10 12:38:20 +01:00
parent 8251ac544a
commit 95a3fc3288
1 changed files with 9 additions and 3 deletions

View File

@ -619,11 +619,17 @@ if !sbt_args_print_sbt_script_version! equ 1 (
rem Handle --version before native client so it works on sbt 2.x project dirs (#8717)
if !sbt_args_print_version! equ 1 (
if !is_this_dir_sbt! equ 1 (
if not "!build_props_sbt_version!" == "" (
echo sbt version in this project: !build_props_sbt_version!
set "local_build_props_version="
if exist "project\build.properties" (
for /F "eol=# delims== tokens=1*" %%a in (project\build.properties) do (
if "%%a" == "sbt.version" if not "%%b" == "" (
set "local_build_props_version=%%b"
)
)
)
if not "!local_build_props_version!" == "" (
echo sbt version in this project: !local_build_props_version!
)
echo sbt runner version: !init_sbt_version!
echo.
echo [info] sbt runner (sbt-the-batch-script) is a runner to run any declared version of sbt.