Skip to content

Commit

Permalink
preserve shellcmdflag and normalize for /bin/sh
Browse files Browse the repository at this point in the history
as it may contain flags not understood by /bin/sh
  • Loading branch information
mirza-s committed Oct 3, 2018
1 parent 3d8e82e commit 01a5d40
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions autoload/go/util.vim
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,13 @@ endfunction
" so that we always use a standard POSIX-compatible Bourne shell (and not e.g.
" csh, fish, etc.) See #988 and #1276.
function! s:system(cmd, ...) abort
" Preserve original shell and shellredir values
" Preserve original shell, shellredir and shellcmdflag values
let l:shell = &shell
let l:shellredir = &shellredir
let l:shellcmdflag = &shellcmdflag

if !go#util#IsWin() && executable('/bin/sh')
set shell=/bin/sh shellredir=>%s\ 2>&1
set shell=/bin/sh shellredir=>%s\ 2>&1 shellcmdflag=-c
endif

try
Expand All @@ -151,6 +152,7 @@ function! s:system(cmd, ...) abort
" Restore original values
let &shell = l:shell
let &shellredir = l:shellredir
let &shellcmdflag = l:shellcmdflag
endtry
endfunction

Expand Down

0 comments on commit 01a5d40

Please sign in to comment.