diff options
author | Tommy Allen <tommy@esdf.io> | 2016-11-12 05:59:15 -0500 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-11-12 11:59:15 +0100 |
commit | 84eed76b552405b0aef442e3eddc7f29f484b2cd (patch) | |
tree | d1ea84b629efd08037d0cee627e800548c100123 | |
parent | 7e48c23a503bf8874533ce76404e202742ef7dac (diff) | |
download | rneovim-84eed76b552405b0aef442e3eddc7f29f484b2cd.tar.gz rneovim-84eed76b552405b0aef442e3eddc7f29f484b2cd.tar.bz2 rneovim-84eed76b552405b0aef442e3eddc7f29f484b2cd.zip |
CheckHealth: Include v:throwpoint in error message (#5575)
* health.vim: Include v:throwpoint in error message
* health/provider.vim: Check for ruby executable
* health/provider.vim: Combine subprocess stdout and stderr
* test: Updated CheckHealth test
-rw-r--r-- | runtime/autoload/health.vim | 2 | ||||
-rw-r--r-- | runtime/autoload/health/provider.vim | 20 | ||||
-rw-r--r-- | test/functional/plugin/health_spec.lua | 1 |
3 files changed, 12 insertions, 11 deletions
diff --git a/runtime/autoload/health.vim b/runtime/autoload/health.vim index a84cb6a3cc..9e32067204 100644 --- a/runtime/autoload/health.vim +++ b/runtime/autoload/health.vim @@ -58,7 +58,7 @@ function! health#check(plugin_names) abort let output = execute( \ 'call health#report_error(''Failed to run healthcheck for "' \ .s:to_plugin_name(c) - \ .'" plugin. Exception:''."\n".v:exception)') + \ .'" plugin. Exception:''."\n".v:throwpoint."\n".v:exception)') endif endtry call append('$', split(output, "\n") + ['']) diff --git a/runtime/autoload/health/provider.vim b/runtime/autoload/health/provider.vim index 16ce2e3249..0d837e9dea 100644 --- a/runtime/autoload/health/provider.vim +++ b/runtime/autoload/health/provider.vim @@ -26,10 +26,8 @@ endfunction " Handler for s:system() function. function! s:system_handler(jobid, data, event) abort - if a:event == 'stdout' - let self.stdout .= join(a:data, '') - elseif a:event == 'stderr' - let self.stderr .= join(a:data, '') + if a:event == 'stdout' || a:event == 'stderr' + let self.output .= join(a:data, '') elseif a:event == 'exit' let s:shell_error = a:data endif @@ -39,8 +37,7 @@ endfunction function! s:system(cmd, ...) abort let stdin = a:0 ? a:1 : '' let opts = { - \ 'stdout': '', - \ 'stderr': '', + \ 'output': '', \ 'on_stdout': function('s:system_handler'), \ 'on_stderr': function('s:system_handler'), \ 'on_exit': function('s:system_handler'), @@ -51,7 +48,7 @@ function! s:system(cmd, ...) abort call health#report_error(printf('Command error %d: %s', jobid, \ type(a:cmd) == type([]) ? join(a:cmd) : a:cmd))) let s:shell_error = 1 - return '' + return opts.output endif if !empty(stdin) @@ -66,10 +63,10 @@ function! s:system(cmd, ...) abort elseif s:shell_error != 0 call health#report_error(printf("Command error (%d) %s: %s", jobid, \ type(a:cmd) == type([]) ? join(a:cmd) : a:cmd, - \ opts.stderr)) + \ opts.output)) endif - return opts.stdout + return opts.output endfunction function! s:systemlist(cmd, ...) abort @@ -409,7 +406,10 @@ endfunction function! s:check_ruby() abort call health#report_start('Ruby provider') - let ruby_version = s:systemlist('ruby -v')[0] + let ruby_version = 'not found' + if executable('ruby') + let ruby_version = s:systemlist('ruby -v')[0] + endif let ruby_prog = provider#ruby#Detect() let suggestions = \ ['Install or upgrade the neovim RubyGem using `gem install neovim`.'] diff --git a/test/functional/plugin/health_spec.lua b/test/functional/plugin/health_spec.lua index 5b5e5f9ace..52dc008707 100644 --- a/test/functional/plugin/health_spec.lua +++ b/test/functional/plugin/health_spec.lua @@ -68,6 +68,7 @@ describe('health.vim', function() health#broken#check ======================================================================== - ERROR: Failed to run healthcheck for "broken" plugin. Exception: + function health#check[20]..health#broken#check, line 1 caused an error ]]) end) |