Skip to content

[2.x] fix: Fixes double quotes handling in fork mode#8765

Merged
eed3si9n merged 3 commits intosbt:developfrom
BrianHotopp:fix/argsfile-escape-double-quotes
Feb 25, 2026
Merged

[2.x] fix: Fixes double quotes handling in fork mode#8765
eed3si9n merged 3 commits intosbt:developfrom
BrianHotopp:fix/argsfile-escape-double-quotes

Conversation

@BrianHotopp
Copy link
Copy Markdown
Contributor

@BrianHotopp BrianHotopp commented Feb 19, 2026

Summary

  • Escape " as \" in Fork.createArgumentsFile so the JVM argument file parser correctly preserves double quotes inside arguments (e.g. JSON strings)
  • Add a regression test that forks a process with a JSON argument through argsfile mode and verifies the quotes survive the round-trip

Fixes #7129

Test plan

  • New property test "Arguments with double quotes preserved in arguments file mode." passes in ForkTest
  • Existing "Arbitrary length classpath successfully passed." property test still passes

🤖 Generated with Claude Code

I also checked that the test I added fails without the fix

BrianHotopp and others added 2 commits February 19, 2026 17:36
When using the arguments file (`@argsfile`) mechanism for forked runs,
double quotes inside arguments were not escaped, causing the JVM's
argument file parser to strip them. For example, passing `{"a":1}` as
an argument would result in `{a:1}`.

Escape `"` as `\"` in `createArgumentsFile`, matching the existing
backslash escaping, so the JVM correctly round-trips quoted arguments.

Fixes sbt#7129

Co-Authored-By: Claude Opus 4.6 <[email protected]>
End-to-end test that builds a project with fork mode and a long
javaOptions value (to trigger argsfile mode), passes a JSON system
property containing double quotes, and verifies the quotes survive
the round-trip.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@eed3si9n eed3si9n changed the title fix: Escape double quotes in arguments file mode [2.x] fix: Fixes double quotes handling in fork mode Feb 21, 2026
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. Could you let me know when you sign the CLA please?

@BrianHotopp
Copy link
Copy Markdown
Contributor Author

Signed

@eed3si9n eed3si9n merged commit 87414a8 into sbt:develop Feb 25, 2026
15 checks passed
@eed3si9n eed3si9n added this to the 1.12.5 milestone Mar 1, 2026
eed3si9n pushed a commit to eed3si9n/sbt that referenced this pull request Mar 1, 2026
When using the arguments file (`@argsfile`) mechanism for forked runs,
double quotes inside arguments were not escaped, causing the JVM's
argument file parser to strip them. For example, passing `{"a":1}` as
an argument would result in `{a:1}`.

Escape `"` as `\"` in `createArgumentsFile`, matching the existing
backslash escaping, so the JVM correctly round-trips quoted arguments.

Fixes sbt#7129

Co-Authored-By: Claude Opus 4.6 <[email protected]>
eed3si9n pushed a commit to eed3si9n/sbt that referenced this pull request Mar 1, 2026
When using the arguments file (`@argsfile`) mechanism for forked runs,
double quotes inside arguments were not escaped, causing the JVM's
argument file parser to strip them. For example, passing `{"a":1}` as
an argument would result in `{a:1}`.

Escape `"` as `\"` in `createArgumentsFile`, matching the existing
backslash escaping, so the JVM correctly round-trips quoted arguments.

Fixes sbt#7129

Co-Authored-By: Claude Opus 4.6 <[email protected]>
eed3si9n pushed a commit to eed3si9n/sbt that referenced this pull request Mar 1, 2026
When using the arguments file (`@argsfile`) mechanism for forked runs,
double quotes inside arguments were not escaped, causing the JVM's
argument file parser to strip them. For example, passing `{"a":1}` as
an argument would result in `{a:1}`.

Escape `"` as `\"` in `createArgumentsFile`, matching the existing
backslash escaping, so the JVM correctly round-trips quoted arguments.

Fixes sbt#7129

Co-Authored-By: Claude Opus 4.6 <[email protected]>
eed3si9n added a commit that referenced this pull request Mar 1, 2026
When using the arguments file (`@argsfile`) mechanism for forked runs,
double quotes inside arguments were not escaped, causing the JVM's
argument file parser to strip them. For example, passing `{"a":1}` as
an argument would result in `{a:1}`.

Escape `"` as `\"` in `createArgumentsFile`, matching the existing
backslash escaping, so the JVM correctly round-trips quoted arguments.

Fixes #7129

Co-authored-by: BrianHotopp <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

run command loses double quotes from the arguments in Fork mode

2 participants