Skip to content

Commit 379cd94

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 379cd94

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
@@ -898,12 +898,7 @@ function! s:run(flags)
898898
let orig_dir = s:chdir_push(s:tmp_work_dir)
899899
let s:cmdline = s:build_cmdline(a:flags)
900900

901-
" '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
901+
let cmd = [&shell, &shellcmdflag, s:cmdline]
907902

908903
let options = {
909904
\ 'cmd': s:cmdline,

0 commit comments

Comments
 (0)