From 87d3f265bc4bcedec146a4da7bb83244cea9fa6b Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 30 Apr 2018 16:48:32 +0200 Subject: health#provider: fix logic with s:shellify It should be quoted if there is any character that needs escaping, but not if there is a character that does not need escaping. --- runtime/autoload/health/provider.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/autoload/health/provider.vim b/runtime/autoload/health/provider.vim index 4adab1aa76..adde784c2a 100644 --- a/runtime/autoload/health/provider.vim +++ b/runtime/autoload/health/provider.vim @@ -51,7 +51,7 @@ function! s:shellify(cmd) abort return a:cmd endif return join(map(copy(a:cmd), - \'v:val =~# ''\m[\-.a-zA-Z_/]'' ? shellescape(v:val) : v:val'), ' ') + \'v:val =~# ''\m[^\-.a-zA-Z_/]'' ? shellescape(v:val) : v:val'), ' ') endfunction " Run a system command and timeout after 30 seconds. -- cgit From 7d8327fd3010c095b0dcdeedd290667d5e15e87d Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 30 Apr 2018 16:50:01 +0200 Subject: health#provider: improve error reporting - quote command, so that e.g. markdown handling is not applied to `__init__.py` - include cwd --- runtime/autoload/health/provider.vim | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/runtime/autoload/health/provider.vim b/runtime/autoload/health/provider.vim index adde784c2a..9296144aaf 100644 --- a/runtime/autoload/health/provider.vim +++ b/runtime/autoload/health/provider.vim @@ -70,7 +70,8 @@ function! s:system(cmd, ...) abort let jobid = jobstart(a:cmd, opts) if jobid < 1 - call health#report_error(printf('Command error (job=%d): %s', jobid, s:shellify(a:cmd))) + call health#report_error(printf('Command error (job=%d): `%s` (in %s)', + \ jobid, s:shellify(a:cmd), string(getcwd()))) let s:shell_error = 1 return opts.output endif @@ -84,8 +85,8 @@ function! s:system(cmd, ...) abort call health#report_error(printf('Command timed out: %s', s:shellify(a:cmd))) call jobstop(jobid) elseif s:shell_error != 0 && !ignore_error - call health#report_error(printf("Command error (job=%d): %s\nOutput: %s", jobid, - \ s:shellify(a:cmd), opts.output)) + call health#report_error(printf("Command error (job=%d): `%s` (in %s)\nOutput: %s", + \ jobid, s:shellify(a:cmd), string(getcwd()), opts.output)) endif return opts.output -- cgit From 1f2301eacfdfb18d6dbd2116d9ab231a97183499 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 30 Apr 2018 16:54:35 +0200 Subject: health#provider: fix sys.path for Python Remove "" from sys.path (typically the first entry), which could cause e.g. "logging" to be added from the current directory. This gets done already for loading the host in runtime/autoload/provider/pythonx.vim. --- runtime/autoload/health/provider.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/runtime/autoload/health/provider.vim b/runtime/autoload/health/provider.vim index 9296144aaf..7067ff6c1d 100644 --- a/runtime/autoload/health/provider.vim +++ b/runtime/autoload/health/provider.vim @@ -186,7 +186,9 @@ function! s:version_info(python) abort endif let nvim_path = s:trim(s:system([ - \ a:python, '-c', 'import neovim; print(neovim.__file__)'])) + \ a:python, '-c', + \ 'import sys; sys.path.remove(""); ' . + \ 'import neovim; print(neovim.__file__)'])) if s:shell_error || empty(nvim_path) return [python_version, 'unable to load neovim Python module', pypi_version, \ nvim_path] -- cgit