aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBarrett Ruth <62671086+barrett-ruth@users.noreply.github.com>2024-01-09 17:05:44 -0600
committerGitHub <noreply@github.com>2024-01-10 07:05:44 +0800
commit63a17322dd835724887517c1309e70c06748ed59 (patch)
treefce4fabaa6a4529dd30b23630e7649359c6eb019
parentc67efe3a9c5b04b1909bf0051476ede495531066 (diff)
downloadrneovim-63a17322dd835724887517c1309e70c06748ed59.tar.gz
rneovim-63a17322dd835724887517c1309e70c06748ed59.tar.bz2
rneovim-63a17322dd835724887517c1309e70c06748ed59.zip
fix(health): improve python executable check error handling (#26954)
Credit to @wookayin for the fix.
-rw-r--r--runtime/lua/provider/python/health.lua7
1 files changed, 3 insertions, 4 deletions
diff --git a/runtime/lua/provider/python/health.lua b/runtime/lua/provider/python/health.lua
index 0b6edf5b42..6d3a4d5c50 100644
--- a/runtime/lua/provider/python/health.lua
+++ b/runtime/lua/provider/python/health.lua
@@ -17,10 +17,9 @@ end
-- Resolves Python executable path by invoking and checking `sys.executable`.
local function python_exepath(invocation)
- local python = vim.fn.fnameescape(invocation)
- local out = vim.fn.system(python .. ' -c "import sys; sys.stdout.write(sys.executable)"')
- assert(vim.v.shell_error == 0, out)
- return vim.fs.normalize(vim.trim(out))
+ local p = vim.system({ invocation, '-c', 'import sys; sys.stdout.write(sys.executable)' }):wait()
+ assert(p.code == 0, p.stderr)
+ return vim.fs.normalize(vim.trim(p.stdout))
end
-- Check if pyenv is available and a valid pyenv root can be found, then return