Skip to content

Commit f9f22e6

Browse files
committed
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> / -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
1 parent 2b93535 commit f9f22e6

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

plugin/grepper.vim

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -899,12 +899,7 @@ function! s:run(flags)
899899
let s:cmdline = s:build_cmdline(a:flags)
900900

901901
" 'cmd' and 'options' are only used for async execution.
902-
if has('win32')
903-
let cmd = 'cmd.exe /c '. s:cmdline
904-
else
905-
let cmd = ['sh', '-c', s:cmdline]
906-
endif
907-
902+
let cmd = [&shell, &shellcmdflag, s:cmdline]
908903
let options = {
909904
\ 'cmd': s:cmdline,
910905
\ 'work_dir': s:tmp_work_dir,

0 commit comments

Comments
 (0)