diff options
Diffstat (limited to 'src/util')
| -rw-r--r-- | src/util/util_windows.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/util/util_windows.go b/src/util/util_windows.go index f29e33be..3a4ab570 100644 --- a/src/util/util_windows.go +++ b/src/util/util_windows.go @@ -7,6 +7,7 @@ import ( "os" "os/exec" "path/filepath" + "regexp" "strings" "sync/atomic" "syscall" @@ -20,6 +21,8 @@ const ( shellTypePowerShell ) +var escapeRegex = regexp.MustCompile(`[&|<>()^%!"]`) + type Executor struct { shell string shellType shellType @@ -131,7 +134,9 @@ func escapeArg(s string) string { b = append(b, '\\') } b = append(b, '"') - return string(b) + return escapeRegex.ReplaceAllStringFunc(string(b), func(match string) string { + return "^" + match + }) } func (x *Executor) QuoteEntry(entry string) string { |
