-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Conversation
let l:output = call(s:vim_system, [a:str] + a:000) | ||
let &shell = l:shell | ||
return l:output | ||
if !(has('win32') || has('win64')) && executable('/bin/sh') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use go#util#IsWin()
here
Maybe this is just easier (I was going to push it now, but you opened first :)): function! go#util#System(str, ...)
if go#util#IsWin()
let l:output = call(s:vim_system, [a:str] + a:000)
return l:output
endif
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
endfunction |
return l:output | ||
finally | ||
let &shell = l:shell | ||
endtry |
There was a problem hiding this comment.
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
Well, in theory there could be systems that don't have The |
So you mean |
Well, more like the Like I said, I'm not sure if this really makes a difference... Both versions are probably fine. |
Thanks @Carpetsmoker |
Don't reset it on Windows, and only reset it if
/bin/sh
is executable (whichshould pretty much always be the case, but it's not in POSIX and IIRC POSIX
explicitly advises against relying on it).
This is basically the same method that vim-plug uses.
This improves #967 and should fix #986.