From 5669f48343cac868eb7432950db61c9aa2383ab6 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Mon, 6 May 2024 12:07:51 +0900 Subject: Do not enable delayed expansion mode when running cmd.exe And simplify the argument escaping code. Fix #3764. This may breaks some existing use cases, but the mode causes too much trouble when escaping arguments and it makes some things not possible. # Now you can pass special characters to rg process without any escaping problems: &|<>()@^%! fzf --ansi --disabled --bind "change:reload:rg --column --line-number --no-heading --color=always --smart-case -- {q}" # No sudden expansion of the arguments on '!' fzf --disabled --preview "echo {q} {n} {}" --query "&|<>()@^%!" --prompt "&|<>()@^%!" --- src/util/util_windows.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/util') diff --git a/src/util/util_windows.go b/src/util/util_windows.go index 9d51cc97..7bbf6ee7 100644 --- a/src/util/util_windows.go +++ b/src/util/util_windows.go @@ -42,7 +42,7 @@ func NewExecutor(withShell string) *Executor { args = args[1:] } else if strings.HasPrefix(basename, "cmd") { shellType = shellTypeCmd - args = []string{"/v:on/s/c"} + args = []string{"/s/c"} } else if strings.HasPrefix(basename, "pwsh") || strings.HasPrefix(basename, "powershell") { shellType = shellTypePowerShell args = []string{"-NoProfile", "-Command"} @@ -119,8 +119,6 @@ func escapeArg(s string) string { slashes = 0 case '\\': slashes++ - case '&', '|', '<', '>', '(', ')', '@', '^', '%', '!': - b = append(b, '^') case '"': for ; slashes > 0; slashes-- { b = append(b, '\\') -- cgit v1.2.3