Skip to content

Commit

Permalink
Do not assume shell for platform
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Sh3Rm4n committed Oct 10, 2021
1 parent 2b93535 commit f9f22e6
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions plugin/grepper.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit f9f22e6

Please sign in to comment.