Only create a command line replacer once
Test: CI Change-Id: Ibb9b822aea808c936fedc4c8fea7b7d787b101d5
This commit is contained in:
@@ -671,17 +671,18 @@ func expandTemplateContent(actionEntry action) string {
|
|||||||
return replacer.Replace(actionEntry.TemplateContent)
|
return replacer.Replace(actionEntry.TemplateContent)
|
||||||
}
|
}
|
||||||
|
|
||||||
func escapeCommandlineArgument(str string) string {
|
// \->\\, $->\$, `->\`, "->\", \n->\\n, '->'"'"'
|
||||||
// \->\\, $->\$, `->\`, "->\", \n->\\n, '->'"'"'
|
var commandLineArgumentReplacer = strings.NewReplacer(
|
||||||
replacer := strings.NewReplacer(
|
|
||||||
`\`, `\\`,
|
`\`, `\\`,
|
||||||
`$`, `\$`,
|
`$`, `\$`,
|
||||||
"`", "\\`",
|
"`", "\\`",
|
||||||
`"`, `\"`,
|
`"`, `\"`,
|
||||||
"\n", "\\n",
|
"\n", "\\n",
|
||||||
`'`, `'"'"'`,
|
`'`, `'"'"'`,
|
||||||
)
|
)
|
||||||
return replacer.Replace(str)
|
|
||||||
|
func escapeCommandlineArgument(str string) string {
|
||||||
|
return commandLineArgumentReplacer.Replace(str)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a action) isSymlinkAction() bool {
|
func (a action) isSymlinkAction() bool {
|
||||||
|
Reference in New Issue
Block a user