Skip to content

Commit

Permalink
correctly escape app_mainclass variable
Browse files Browse the repository at this point in the history
  • Loading branch information
mberndt123 committed Apr 5, 2024
1 parent 9e009b0 commit b2f9fd5
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,19 @@ object BashStartScriptPlugin extends AutoPlugin with ApplicationIniGenerator wit
else
""

private[this] def shellEscape(s: String): String =
if (s.startsWith("-jar"))
s
else
s"'${s.replace("'", "'\\''")}'"

override protected[this] def createReplacementsForMainScript(
mainClass: String,
mainClasses: Seq[String],
config: SpecializedScriptConfig
): Seq[(String, String)] =
Seq(
"app_mainclass" -> mainClass,
"app_mainclass" -> shellEscape(mainClass),
"available_main_classes" -> usageMainClassReplacement(mainClasses)
) ++ config.replacements
}

0 comments on commit b2f9fd5

Please sign in to comment.