From 92f03a7872534657e0857cc72a51bdfca1fddb54 Mon Sep 17 00:00:00 2001 From: Ryooooooga Date: Tue, 12 Oct 2021 21:08:32 +0900 Subject: Escape special characters --- pkg/commands/oscommands/os.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'pkg/commands') diff --git a/pkg/commands/oscommands/os.go b/pkg/commands/oscommands/os.go index d560f6d57..b6181364f 100644 --- a/pkg/commands/oscommands/os.go +++ b/pkg/commands/oscommands/os.go @@ -202,7 +202,13 @@ func (c *OSCommand) ShellCommandFromString(commandStr string) *exec.Cmd { quotedCommand := "" // Windows does not seem to like quotes around the command if c.Platform.OS == "windows" { - quotedCommand = strings.Replace(commandStr, "&", "^&", -1) + quotedCommand = commandStr + quotedCommand = strings.Replace(quotedCommand, "^", "^^", -1) + quotedCommand = strings.Replace(quotedCommand, "&", "^&", -1) + quotedCommand = strings.Replace(quotedCommand, "|", "^|", -1) + quotedCommand = strings.Replace(quotedCommand, "<", "^<", -1) + quotedCommand = strings.Replace(quotedCommand, ">", "^>", -1) + quotedCommand = strings.Replace(quotedCommand, "%", "^%", -1) } else { quotedCommand = c.Quote(commandStr) } -- cgit v1.2.3