Repository navigation
Keep sbt launcher options out of the joined command string - #235
Merged
Merged
Conversation
Since sbt steps are rendered as one quoted, semicolon-separated command string, an argument meant for the sbt launcher, such as -Dslick.testkit-config=..., ends up inside it. sbt then tries to run it as a command and fails with "Not a valid command: -", under both sbt 1 and sbt 2. Arguments starting with '-' are launcher options, never commands, so render them as separate arguments ahead of the command string. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since #227 (released in 0.31.0), an sbt step's preamble and commands are rendered as one quoted,
;-separated command string. That broke steps that pass sbt launcher options. For exampleused to render as
and now renders as
which sbt rejects with
Not a valid command: -. (Seen in nafg/slick-migration-api#521.)Fix
Arguments starting with
-(-D…,-J…,-v) are options for the sbt launcher, never commands, so they are now rendered as separate arguments ahead of the command string:Options containing a space are single-quoted, as all arguments with spaces were before #227. Steps without launcher options render exactly as they do now.
Verification
Ran both forms by hand against a build with a task that prints a system property:
sbt -Dprobe.x=hello '++ 2.13.18; probe'sbt '++ 2.13.18; -Dprobe.x=hello; probe'probe.x = Some(hello)Not a valid command: -probe.x = Some(hello)Not a valid command: -Under sbt 2 the property reaches the server only when that invocation starts it. If an earlier step left a server running, the client connects to it and the option doesn't reach it. That was equally true before #227, so this PR doesn't change it.
Added two
GenerativePluginSpeccases (a plain launcher option, and one containing a space).githubWorkflowCheck,+test(84 examples on each of sbt 1 and sbt 2) and+scriptedpass.🤖 Generated with Claude Code