mirror of
https://github.com/neovim/neovim.git
synced 2024-12-31 17:13:26 -07:00
Merge #6721 from justinmk/health
This commit is contained in:
commit
f57149d2f4
@ -66,6 +66,7 @@ function! health#check(plugin_names) abort
|
|||||||
" needed for plasticboy/vim-markdown, because it uses fdm=expr
|
" needed for plasticboy/vim-markdown, because it uses fdm=expr
|
||||||
normal! zR
|
normal! zR
|
||||||
setlocal nomodified
|
setlocal nomodified
|
||||||
|
setlocal bufhidden=hide
|
||||||
redraw|echo ''
|
redraw|echo ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -38,6 +38,16 @@ function! s:system_handler(jobid, data, event) dict abort
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" Attempts to construct a shell command from an args list.
|
||||||
|
" Only for display, to help users debug a failed command.
|
||||||
|
function! s:shellify(cmd) abort
|
||||||
|
if type(a:cmd) != type([])
|
||||||
|
return a:cmd
|
||||||
|
endif
|
||||||
|
return join(map(copy(a:cmd),
|
||||||
|
\'v:val =~# ''\m[\-.a-zA-Z_/]'' ? shellescape(v:val) : v:val'), ' ')
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Run a system command and timeout after 30 seconds.
|
" Run a system command and timeout after 30 seconds.
|
||||||
function! s:system(cmd, ...) abort
|
function! s:system(cmd, ...) abort
|
||||||
let stdin = a:0 ? a:1 : ''
|
let stdin = a:0 ? a:1 : ''
|
||||||
@ -54,8 +64,7 @@ function! s:system(cmd, ...) abort
|
|||||||
let jobid = jobstart(a:cmd, opts)
|
let jobid = jobstart(a:cmd, opts)
|
||||||
|
|
||||||
if jobid < 1
|
if jobid < 1
|
||||||
call health#report_error(printf('Command error %d: %s', jobid,
|
call health#report_error(printf('Command error (job=%d): %s', jobid, s:shellify(a:cmd)))
|
||||||
\ type(a:cmd) == type([]) ? join(a:cmd) : a:cmd))
|
|
||||||
let s:shell_error = 1
|
let s:shell_error = 1
|
||||||
return opts.output
|
return opts.output
|
||||||
endif
|
endif
|
||||||
@ -66,13 +75,11 @@ function! s:system(cmd, ...) abort
|
|||||||
|
|
||||||
let res = jobwait([jobid], 30000)
|
let res = jobwait([jobid], 30000)
|
||||||
if res[0] == -1
|
if res[0] == -1
|
||||||
call health#report_error(printf('Command timed out: %s',
|
call health#report_error(printf('Command timed out: %s', s:shellify(a:cmd)))
|
||||||
\ type(a:cmd) == type([]) ? join(a:cmd) : a:cmd))
|
|
||||||
call jobstop(jobid)
|
call jobstop(jobid)
|
||||||
elseif s:shell_error != 0 && !ignore_error
|
elseif s:shell_error != 0 && !ignore_error
|
||||||
call health#report_error(printf('Command error (%d) %s: %s', jobid,
|
call health#report_error(printf("Command error (job=%d): %s\nOutput: %s", jobid,
|
||||||
\ type(a:cmd) == type([]) ? join(a:cmd) : a:cmd,
|
\ s:shellify(a:cmd), opts.output))
|
||||||
\ opts.output))
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return opts.output
|
return opts.output
|
||||||
@ -157,7 +164,7 @@ function! s:version_info(python) abort
|
|||||||
\ ]))
|
\ ]))
|
||||||
|
|
||||||
if empty(python_version)
|
if empty(python_version)
|
||||||
let python_version = 'unable to parse python response'
|
let python_version = 'unable to parse '.a:python.' response'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let nvim_path = s:trim(s:system([
|
let nvim_path = s:trim(s:system([
|
||||||
@ -176,7 +183,7 @@ function! s:version_info(python) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Try to get neovim.VERSION (added in 0.1.11dev).
|
" Try to get neovim.VERSION (added in 0.1.11dev).
|
||||||
let nvim_version = s:system(['python', '-c',
|
let nvim_version = s:system([a:python, '-c',
|
||||||
\ 'from neovim import VERSION as v; '.
|
\ 'from neovim import VERSION as v; '.
|
||||||
\ 'print("{}.{}.{}{}".format(v.major, v.minor, v.patch, v.prerelease))'],
|
\ 'print("{}.{}.{}{}".format(v.major, v.minor, v.patch, v.prerelease))'],
|
||||||
\ '', 1, 1)
|
\ '', 1, 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user