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)
|
||||
}
|
||||
|
||||
// \->\\, $->\$, `->\`, "->\", \n->\\n, '->'"'"'
|
||||
var commandLineArgumentReplacer = strings.NewReplacer(
|
||||
`\`, `\\`,
|
||||
`$`, `\$`,
|
||||
"`", "\\`",
|
||||
`"`, `\"`,
|
||||
"\n", "\\n",
|
||||
`'`, `'"'"'`,
|
||||
)
|
||||
|
||||
func escapeCommandlineArgument(str string) string {
|
||||
// \->\\, $->\$, `->\`, "->\", \n->\\n, '->'"'"'
|
||||
replacer := strings.NewReplacer(
|
||||
`\`, `\\`,
|
||||
`$`, `\$`,
|
||||
"`", "\\`",
|
||||
`"`, `\"`,
|
||||
"\n", "\\n",
|
||||
`'`, `'"'"'`,
|
||||
)
|
||||
return replacer.Replace(str)
|
||||
return commandLineArgumentReplacer.Replace(str)
|
||||
}
|
||||
|
||||
func (a action) isSymlinkAction() bool {
|
||||
|
Reference in New Issue
Block a user