Skip to content

Commit

Permalink
fix a bug in ash-template
Browse files Browse the repository at this point in the history
  • Loading branch information
mberndt123 committed Apr 27, 2024
1 parent 0f69b0c commit 1789dcb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ addApp () {
}

shellEscape () {
printf "'%s'" "$(printf %s "$1" | sed "s/'/'\\\\''/")"
printf "'%s'" "$(printf %s "$1" | sed "s/'/'\\\\''/g")"
}

addResidual () {
Expand Down
4 changes: 2 additions & 2 deletions src/sbt-test/ash/command-line-settings/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ TaskKey[Unit]("checkResidual") := {
}

TaskKey[Unit]("checkComplexResidual") := {
val args = Seq("-J-Dfoo=bar", "arg1", "--", "-J-Dfoo=bar", "arg 2", "--", "\"", "$foo", "'", "%s", "-y", "bla", "\\'", "\\\"")
val args = Seq("-J-Dfoo=bar", "arg1", "--", "-J-Dfoo=bar", "arg 2", "--", "\"", "$foo", "'", "%s", "-y", "bla", "\\'", "\\\"", "''")
val cwd = (stagingDirectory in Universal).value
val cmd = Seq((cwd / "bin" / packageName.value).getAbsolutePath) ++ args
val expected = """arg1|-J-Dfoo=bar|arg 2|--|"|$foo|'|%s|-y|bla|\'|\""""
val expected = """arg1|-J-Dfoo=bar|arg 2|--|"|$foo|'|%s|-y|bla|\'|\"|''"""

val output = (sys.process.Process(cmd, cwd).!!).split("\n").last
assert(output == expected, s"Application did not receive residual args '$expected' (got '$output')")
Expand Down

0 comments on commit 1789dcb

Please sign in to comment.