Skip to content

Commit

Permalink
Merge pull request #2006 from mirza-s/master
Browse files Browse the repository at this point in the history
preserve shellcmdflag and normalize for /bin/sh
  • Loading branch information
bhcleek authored Oct 4, 2018
2 parents 3d8e82e + 01a5d40 commit 5971612
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 5971612

Please sign in to comment.