Skip to content

Windows start script interprets commas (,) and splits arguments where it should just pass them to the application #1650

@mpollmeier

Description

@mpollmeier

Expected behaviour

Commas (,) in arguments should be handed over to the application rather than interpreted by the start script.

Actual behaviour

For the linux start script, that's the case.
The windows starter script interprets the comma and splits it up into separate arguments.

Way to reproduce

mkdir -p project src/main/scala
echo 'sbt.version=1.10.5' > project/build.properties
echo 'addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.10.4")' > project/plugins.sbt
echo 'enablePlugins(JavaAppPackaging)' > build.sbt
echo 'object Foo { 
  def main(args: Array[String]) = { 
    println(args.size)
    args.foreach(println) 
  }
}' > Foo.scala
sbt stage

# on linux:
target/universal/stage/bin/native-packager-demo a b,bb c
3
a
b,bb
c

# on windows:
.\target\universal\stage\bin\native-packager-demo.bat a b,bb c
4
a
b
bb
c

Workaround: triple double-quotes

.\target\universal\stage\bin\native-packager-demo.bat a """b,bb""" c
3
a
b,bb
c

Extra context

This is not a windows powershell issue - the below works correctly on both linux and windows:

echo 'class Bar {
  public static void main(String[] args) {
    System.out.println(args.length);
    for (String arg : args) { 
      System.out.println(arg);
    }
  }
}' > Bar.java

java Bar.java a b,bb c
# output on both linux and windows:
3
a
b,bb
c

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions