Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More robust resetting of the shell. #988

Merged
merged 2 commits into from
Aug 2, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions autoload/go/util.vim
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,20 @@ else
let s:vim_shell_error = ''
endif

" System runs a shell command. It will reset the shell to /bin/sh for Unix-like
" systems if it is executable.
function! go#util#System(str, ...)
let l:shell = &shell
let &shell = '/bin/sh'
let l:output = call(s:vim_system, [a:str] + a:000)
let &shell = l:shell
return l:output
if !go#util#IsWin() && executable('/bin/sh')
let &shell = '/bin/sh'
endif

try
let l:output = call(s:vim_system, [a:str] + a:000)
return l:output
finally
let &shell = l:shell
endtry
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why we have this try clause. Why not just :

let l:output = call(s:vim_system, [a:str] + a:000)
let &shell = l:shell
return l:output

endfunction

function! go#util#ShellError()
Expand Down