mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-07 22:02:56 +03:00
fix: escape quote character on Linux
Co-authored-by: Dawid Dziurla <dawidd0811@gmail.com> Closes #269
This commit is contained in:
@@ -140,6 +140,13 @@ func (c *OSCommand) PrepareSubProcess(cmdName string, commandArgs ...string) *ex
|
|||||||
// Quote wraps a message in platform-specific quotation marks
|
// Quote wraps a message in platform-specific quotation marks
|
||||||
func (c *OSCommand) Quote(message string) string {
|
func (c *OSCommand) Quote(message string) string {
|
||||||
message = strings.Replace(message, "`", "\\`", -1)
|
message = strings.Replace(message, "`", "\\`", -1)
|
||||||
|
if c.Platform.os == "linux" {
|
||||||
|
if strings.ContainsRune(message, '\'') {
|
||||||
|
c.Platform.escapedQuote = `"`
|
||||||
|
} else {
|
||||||
|
c.Platform.escapedQuote = `'`
|
||||||
|
}
|
||||||
|
}
|
||||||
return c.Platform.escapedQuote + message + c.Platform.escapedQuote
|
return c.Platform.escapedQuote + message + c.Platform.escapedQuote
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user