[vim] Fix version check on windows/powershell (#2894)

- Replace fzf#shellescape with shellescape
- Prepend command with '&' in powershell to deal with quoted exe
This commit is contained in:
Carl Kamholtz 2022-07-29 09:18:06 +10:00 committed by GitHub
parent ecc418ba77
commit 728f735281
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -164,7 +164,7 @@ function s:get_version(bin)
if has_key(s:versions, a:bin) if has_key(s:versions, a:bin)
return s:versions[a:bin] return s:versions[a:bin]
end end
let command = fzf#shellescape(a:bin) . ' --version --no-height' let command = (&shell == 'powershell' ? '&' : '') . shellescape(a:bin) . ' --version --no-height'
let output = systemlist(command) let output = systemlist(command)
if v:shell_error || empty(output) if v:shell_error || empty(output)
return '' return ''