From f9f22e60f6d487bcb167a96bde2796532063c942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Vi=C3=B6l?= Date: Sun, 10 Oct 2021 19:15:01 +0200 Subject: [PATCH] Do not assume shell for platform win32 does not necessarily mean `cmd.exe` as well as others does not mean `sh`. Problem is, that previous functions, like s:escape_cword() do respect `shell` e.g. with `shellescape()`, but passing the arguments to `job_start()` / jobstart() does ignore `shell`. This leads to trouble. E.g. I use `fish`, where `shellescape()` escapes `\`, which means if / -cword is used (e.g. `Aword`), s:escape_cword() results to `\\bAword\\b` (which is correct), but this string is then passed to `jobstart()` executed by `sh`, which does not share the same escaping rules --- plugin/grepper.vim | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/plugin/grepper.vim b/plugin/grepper.vim index 3552d51..291aaa7 100644 --- a/plugin/grepper.vim +++ b/plugin/grepper.vim @@ -899,12 +899,7 @@ function! s:run(flags) let s:cmdline = s:build_cmdline(a:flags) " 'cmd' and 'options' are only used for async execution. - if has('win32') - let cmd = 'cmd.exe /c '. s:cmdline - else - let cmd = ['sh', '-c', s:cmdline] - endif - + let cmd = [&shell, &shellcmdflag, s:cmdline] let options = { \ 'cmd': s:cmdline, \ 'work_dir': s:tmp_work_dir,