Skip to content

[2.x] Fix debug options breaking launcher on Windows#8440

Merged
eed3si9n merged 2 commits intosbt:developfrom
MkDev11:fix/windows-debug-options-8100
Jan 6, 2026
Merged

[2.x] Fix debug options breaking launcher on Windows#8440
eed3si9n merged 2 commits intosbt:developfrom
MkDev11:fix/windows-debug-options-8100

Conversation

@MkDev11
Copy link
Copy Markdown
Contributor

@MkDev11 MkDev11 commented Jan 6, 2026

Fix debug options breaking launcher on Windows

Fixes #8100

Steps

On Windows with sbt 1.10.11, setting debug options via SBT_OPTS breaks the launcher:

set SBT_OPTS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=localhost:1234
sbt.bat

Problems

When the JVM debug agent starts, it prints Listening for transport dt_socket at address: 1234 to stdout. The copyrt function captures this output and tries to parse it as a file path, which fails with InvalidPathException due to the colon character.

The root cause is that the Windows batch script reads the first line of --rt-ext-dir output without any filtering:

set /p java9_ext= < "%TEMP%.\rtext.txt"

Expectations

sbt should launch normally even when debug options are set, allowing developers to attach a debugger.

Solution

I added filtering to the Windows batch script so it only picks up the line containing java9-rt-ext-, which is the actual path we care about. This matches what the Unix script already does with grep java9-rt-ext-.

for /f "tokens=*" %%a in ('findstr /c:"java9-rt-ext-" "%TEMP%.\rtext.txt"') do set "java9_ext=%%a"

Now any debug agent noise gets ignored, and only the rt.jar path is captured.

Notes

As discussed with @eed3si9n in #8100, this is a minimal fix that brings the Windows script in line with the Unix behavior. A more robust solution (using a RTJAR= prefix) could be done later if needed, but this should address the immediate issue.


Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=94194147

Filter rt-ext-dir output for java9-rt-ext- pattern, matching the
Unix script behavior. This prevents debug agent stdout (e.g.,
'Listening for transport dt_socket at address: 1234') from being
incorrectly parsed as a file path.

Fixes sbt#8100
@MkDev11
Copy link
Copy Markdown
Contributor Author

MkDev11 commented Jan 6, 2026

@eed3si9n Please have a look at the PR and let me know your feedback.

@MkDev11
Copy link
Copy Markdown
Contributor Author

MkDev11 commented Jan 6, 2026

Thank you for signing the Scala CLA.

If you have already sent a pull request please add a comment to the pull request saying you did sign the CLA.

We are looking forward to your contributions!

The Scala Team
email: [email protected]
lightbend.com

Just got the reply from the team.

@eed3si9n
Copy link
Copy Markdown
Member

eed3si9n commented Jan 6, 2026

Reran the CLA check, and it passed.

Copy link
Copy Markdown
Member

@eed3si9n eed3si9n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@MkDev11
Copy link
Copy Markdown
Contributor Author

MkDev11 commented Jan 6, 2026

@eed3si9n Can you please merge this PR and close the issue?

@eed3si9n
Copy link
Copy Markdown
Member

eed3si9n commented Jan 6, 2026

I'm leaving it open in case others want to review it as well.

Copy link
Copy Markdown
Member

@anatoliykmetyuk anatoliykmetyuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, would be good to explore adding a regression test here.

@MkDev11
Copy link
Copy Markdown
Contributor Author

MkDev11 commented Jan 6, 2026

LGTM, would be good to explore adding a regression test here.

@anatoliykmetyuk please have a look at the changes.

@anatoliykmetyuk
Copy link
Copy Markdown
Member

Great, thanks @MkDev11 !

@MkDev11
Copy link
Copy Markdown
Contributor Author

MkDev11 commented Jan 6, 2026

@eed3si9n When are you going to merge the PR?

@eed3si9n eed3si9n changed the title Fix debug options breaking launcher on Windows [2.x] Fix debug options breaking launcher on Windows Jan 6, 2026
@eed3si9n
Copy link
Copy Markdown
Member

eed3si9n commented Jan 6, 2026

We can land it once the CI passes.

@MkDev11
Copy link
Copy Markdown
Contributor Author

MkDev11 commented Jan 6, 2026

We can land it once the CI passes.

All passed!

@eed3si9n eed3si9n merged commit 948f12c into sbt:develop Jan 6, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

debug options break launcher

3 participants