diff options
author | Sascha Andres <sascha.andres@outlook.com> | 2018-09-10 06:34:26 +0200 |
---|---|---|
committer | Sascha Andres <sascha.andres@outlook.com> | 2018-09-10 06:36:15 +0200 |
commit | 717913e64c36fa5f468ac32c619afd6e3643a532 (patch) | |
tree | 5f9a9f07f1a478c9431d20486aec4f4a453c87f7 /pkg/commands/os.go | |
parent | 5a0431bb6237ccb314bc2688906b9f9c5cafbfa4 (diff) |
fix: escape quote character on Linux
Co-authored-by: Dawid Dziurla <dawidd0811@gmail.com>
Closes #269
Diffstat (limited to 'pkg/commands/os.go')
-rw-r--r-- | pkg/commands/os.go | 7 |
1 files changed, 7 insertions, 0 deletions
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 } |