Use absolute path to /usr/bin/env

Based on the prevalence of /usr/bin/env shebangs, I trust it is safe to
hard code this.  Or at least, it's safer than trusting the user not to
create a script called env.
This commit is contained in:
Tim Pope
2021-07-27 15:23:10 -04:00
parent 93f25f6883
commit c417518819

View File

@@ -251,7 +251,7 @@ function! s:GitCmd() abort
let string = g:fugitive_git_executable
let list = []
if string =~# '^\w\+='
call add(list, 'env')
call add(list, '/usr/bin/env')
endif
while string =~# '\S'
let arg = matchstr(string, '^\s*\%(' . dquote . '''[^'']*''\|\\.\|[^[:space:] |]\)\+')
@@ -479,7 +479,7 @@ function! s:BuildEnvPrefix(env) abort
elseif s:winshell()
return join(map(env, '"set " . substitute(join(v:val, "="), "[&|<>^]", "^^^&", "g") . "& "'), '')
else
return 'env ' . s:shellesc(map(env, 'join(v:val, "=")')) . ' '
return '/usr/bin/env ' . s:shellesc(map(env, 'join(v:val, "=")')) . ' '
endif
endfunction
@@ -491,7 +491,7 @@ function! s:JobOpts(cmd, env) abort
endif
let envlist = map(items(a:env), 'join(v:val, "=")')
if !has('win32')
return [['env'] + envlist + a:cmd, {}]
return [['/usr/bin/env'] + envlist + a:cmd, {}]
else
let pre = join(map(envlist, '"set " . substitute(v:val, "[&|<>^]", "^^^&", "g") . "& "'), '')
if len(a:cmd) == 3 && a:cmd[0] ==# 'cmd.exe' && a:cmd[1] ==# '/c'