Merge pull request #8440 from MkDev11/fix/windows-debug-options-8100

[2.x] Fix debug options breaking launcher on Windows
This commit is contained in:
eugene yokota 2026-01-06 15:48:07 -05:00 committed by GitHub
commit 948f12cf54
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 1 deletions

View File

@ -208,6 +208,17 @@ object SbtScriptTest extends SimpleTestSuite with PowerAssertions {
)
}
// Regression test for https://github.com/sbt/sbt/issues/8100
// Debug agent output in SBT_OPTS should not break the launcher on Windows
makeTest(
"sbt with debug agent in SBT_OPTS",
sbtOpts = "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=12346"
)("-v") { out: List[String] =>
assert(
out.contains[String]("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=12346")
)
}
makeTest("sbt --no-share adds three system properties")("--no-share") { out: List[String] =>
assert(out.contains[String]("-Dsbt.global.base=project/.sbtboot"))
assert(out.contains[String]("-Dsbt.boot.directory=project/.boot"))

View File

@ -980,7 +980,9 @@ exit /B 1
:copyrt
if /I !JAVA_VERSION! GEQ 9 (
"!_JAVACMD!" !_JAVA_OPTS! !_SBT_OPTS! -jar "!sbt_jar!" --rt-ext-dir > "%TEMP%.\rtext.txt"
set /p java9_ext= < "%TEMP%.\rtext.txt"
rem Filter for the line containing java9-rt-ext- to avoid picking up debug agent output
set "java9_ext="
for /f "tokens=*" %%a in ('findstr /c:"java9-rt-ext-" "%TEMP%.\rtext.txt"') do set "java9_ext=%%a"
set "java9_rt=!java9_ext!\rt.jar"
if not exist "!java9_rt!" (