fix: Avoid file I/O in --version handler to prevent Windows hangs (#8717)

Use already-read build_props_sbt_version and is_this_dir_sbt variables
instead of reading build.properties again in the handler. This avoids
file I/O operations that could cause hangs on Windows.
This commit is contained in:
Eruis2579 2026-02-10 16:55:44 +01:00
parent 95a3fc3288
commit 2d26055de0
1 changed files with 1139 additions and 1145 deletions

View File

@ -619,22 +619,16 @@ 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 (
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 !is_this_dir_sbt! equ 1 (
if not "!build_props_sbt_version!" == "" (
echo sbt version in this project: !build_props_sbt_version!
)
)
)
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.
echo [info] Actual version of the sbt is declared using project\build.properties for each build.
goto :eof
exit /B 0
)
if !run_native_client! equ 1 (