aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-02-15 19:02:52 -0500
committerGitHub <noreply@github.com>2020-02-15 16:02:52 -0800
commita1d6c2f5c9e7834ec6eb087b72354a1257582f3d (patch)
treef118e5463d0c2604f4f6616531c0a175b9cdbf1e
parentdc0e534a9168452b4fd78a1cca02214d6d9c73d0 (diff)
downloadrneovim-a1d6c2f5c9e7834ec6eb087b72354a1257582f3d.tar.gz
rneovim-a1d6c2f5c9e7834ec6eb087b72354a1257582f3d.tar.bz2
rneovim-a1d6c2f5c9e7834ec6eb087b72354a1257582f3d.zip
checkhealth: allow 'sudo install' of 'Neovim::Ext' #11874
cpanm cannot look for Perl modules from root directories without sudo so it creates '~/perl5/' and look for Perl modules in there. Whether this directory existed before running cpanm or not, cpanm returns a warning to advice the user to setup local::lib in order to use modules in '~/perl5/' and exits with error code 0. Each line in the warning always starts with '!'. Display this warning to the user. Continue parsing the version number if the warning can be ignored because lines that are not prefixed with '!' are valid output. Fix #11858
-rw-r--r--runtime/autoload/health/provider.vim16
1 files changed, 15 insertions, 1 deletions
diff --git a/runtime/autoload/health/provider.vim b/runtime/autoload/health/provider.vim
index 601a8f83ef..86f9f060ff 100644
--- a/runtime/autoload/health/provider.vim
+++ b/runtime/autoload/health/provider.vim
@@ -710,13 +710,27 @@ function! s:check_perl() abort
let latest_cpan_cmd = 'cpanm --info -q Neovim::Ext'
let latest_cpan = s:system(latest_cpan_cmd)
- if s:shell_error || empty(latest_cpan) || latest_cpan[0] ==# '!'
+ if s:shell_error || empty(latest_cpan)
call health#report_error('Failed to run: '. latest_cpan_cmd,
\ ["Make sure you're connected to the internet.",
\ 'Are you behind a firewall or proxy?'])
return
+ elseif latest_cpan[0] ==# '!'
+ let cpanm_errs = split(latest_cpan, '!')
+ if cpanm_errs[0] =~# "Can't write to "
+ call health#report_warn(cpanm_errs[0], cpanm_errs[1:-2])
+ " Last line is the package info
+ let latest_cpan = cpanm_errs[-1]
+ else
+ call health#report_error('Unknown warning from command: ' . latest_cpan_cmd, cpanm_errs)
+ return
+ endif
endif
let latest_cpan = matchstr(latest_cpan, '\(\.\?\d\)\+')
+ if empty(latest_cpan)
+ call health#report_error('Cannot parse version number from cpanm output: ' . latest_cpan)
+ return
+ endif
let current_cpan_cmd = [host, '-W', '-MNeovim::Ext', '-e', 'print $Neovim::Ext::VERSION']
let current_cpan = s:system(current_cpan_cmd)