Skip to content

Commit

Permalink
Fix escaping in interpolated string for tool runner
Browse files Browse the repository at this point in the history
```
scala> val tool = "scalap"
tool: String = scalap

scala> s"cmd.exe /c tools\$tool.bat -p"
scala.StringContext$InvalidEscapeException: invalid escape at terminal index 16 in "cmd.exe /c tools\". Use \\ for literal \.
  at scala.StringContext$.loop$1(StringContext.scala:211)
  at scala.StringContext$.replace$1(StringContext.scala:246)
  at scala.StringContext$.treatEscapes0(StringContext.scala:250)
  at scala.StringContext$.treatEscapes(StringContext.scala:195)
  ...

scala> s"cmd.exe /c tools\\$tool.bat -p"
res2: String = cmd.exe /c tools\scalap.bat -p
```
  • Loading branch information
retronym committed Mar 10, 2015
1 parent 37585f9 commit dbcedfb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ lazy val generateVersionPropertiesFileImpl: Def.Initialize[Task[File]] = Def.tas
def executeTool(tool: String) = {
val cmd =
if (System.getProperty("os.name").toLowerCase.contains("windows"))
s"cmd.exe /c tools\$tool.bat -p"
s"cmd.exe /c tools\\$tool.bat -p"
else s"tools/$tool"
Process(cmd).lines.head
}
Expand Down

0 comments on commit dbcedfb

Please sign in to comment.