Merge pull request #321 from XenonAbe/sbtIssue5223

Fix --jvm-debug not working on Windows
This commit is contained in:
eugene yokota 2020-03-03 22:42:17 -05:00 committed by GitHub
commit 25c1b96dae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 0 deletions

View File

@ -190,4 +190,10 @@ object SbtRunnerTest extends SimpleTestSuite with PowerAssertions {
assert(out.contains[String]("[info] HelloTest"))
()
}
test("sbt --jvm-debug <port>") {
val out = sbtProcess("--jvm-debug", "12345", "compile", "-v").!!.linesIterator.toList
assert(out.contains[String]("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=12345"))
()
}
}

View File

@ -375,6 +375,9 @@ if defined _jvm_debug_arg (
rem next argument wasn't a port, set a default and process next arg
set /A JVM_DEBUG_PORT=5005
goto args_loop
) else (
shift
goto args_loop
)
)
)
@ -637,6 +640,18 @@ if not "%p:~0,5%" == "-XX:+" if not "%p:~0,5%" == "-XX:-" if "%p:~0,3%" == "-XX"
)
)
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 (
rem make sure it doesn't have the '=' already
if "%p%" == "%%a" if not "%~1" == "" if not "%~2" == "" if not "%~3" == "" if not "%~4" == "" if not "%~5" == "" if not "%~6" == "" if not "%~7" == "" if not "%~8" == "" (
echo %0=%1=%2,%3=%4,%5=%6,%7=%8
shift & shift & shift & shift & shift & shift & shift & shift
goto echolist
)
)
)
echo %0
goto echolist