Skip to content

Commit

Permalink
Do NOT escape executable (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
lambdalisue authored Apr 25, 2024
1 parent 04469d8 commit b97fab5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions autoload/suda.vim
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
" Returns a string that is safe to pass to `system` on both vim and neovim
function! s:get_command(opts, cmd)
if g:suda#executable ==# 'sudo'
let ret = [g:suda#executable] + a:opts + ['--'] + a:cmd
let ret = a:opts + ['--'] + a:cmd
else
" TODO:
" Should we pass '--' before cmd when using a custom suda#executable?
" Should suda#executable be split? Should we allow suda#executable to be a list instead?
" This behavior is entirely undocumented
let ret = [g:suda#executable] + a:cmd
let ret = a:cmd
endif

" TODO: Should we detect `has('neovim')` and return a list to avoid a shell?
return join(map(ret, { k, v -> shellescape(v) }), ' ')
return join([g:suda#executable] + map(ret, { k, v -> shellescape(v) }), ' ')
endfunction

" {cmd} is a argv list for the process
Expand Down

0 comments on commit b97fab5

Please sign in to comment.