mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-28 16:02:01 +03:00
Escape special characters
This commit is contained in:
committed by
Jesse Duffield
parent
2dc8396deb
commit
92f03a7872
@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user