From 717913e64c36fa5f468ac32c619afd6e3643a532 Mon Sep 17 00:00:00 2001 From: Sascha Andres Date: Mon, 10 Sep 2018 06:34:26 +0200 Subject: [PATCH] fix: escape quote character on Linux Co-authored-by: Dawid Dziurla Closes #269 --- pkg/commands/os.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/commands/os.go b/pkg/commands/os.go index 834c45376..fd77f21c7 100644 --- a/pkg/commands/os.go +++ b/pkg/commands/os.go @@ -140,6 +140,13 @@ func (c *OSCommand) PrepareSubProcess(cmdName string, commandArgs ...string) *ex // Quote wraps a message in platform-specific quotation marks func (c *OSCommand) Quote(message string) string { 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 }