mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 18:55:14 -07:00
fix(health): improve python executable check error handling (#26954)
Credit to @wookayin for the fix.
This commit is contained in:
parent
c67efe3a9c
commit
63a17322dd
@ -17,10 +17,9 @@ end
|
|||||||
|
|
||||||
-- Resolves Python executable path by invoking and checking `sys.executable`.
|
-- Resolves Python executable path by invoking and checking `sys.executable`.
|
||||||
local function python_exepath(invocation)
|
local function python_exepath(invocation)
|
||||||
local python = vim.fn.fnameescape(invocation)
|
local p = vim.system({ invocation, '-c', 'import sys; sys.stdout.write(sys.executable)' }):wait()
|
||||||
local out = vim.fn.system(python .. ' -c "import sys; sys.stdout.write(sys.executable)"')
|
assert(p.code == 0, p.stderr)
|
||||||
assert(vim.v.shell_error == 0, out)
|
return vim.fs.normalize(vim.trim(p.stdout))
|
||||||
return vim.fs.normalize(vim.trim(out))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check if pyenv is available and a valid pyenv root can be found, then return
|
-- Check if pyenv is available and a valid pyenv root can be found, then return
|
||||||
|
Loading…
Reference in New Issue
Block a user