fix: check exit code of proc
See https://github.com/nvim-neotest/neotest/issues/127
This commit is contained in:
@@ -43,8 +43,8 @@ function M.get_python_command(root)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if lib.files.exists("Pipfile") then
|
if lib.files.exists("Pipfile") then
|
||||||
local success, _, data = pcall(lib.process.run, { "pipenv", "--py" }, { stdout = true })
|
local success, exit_code, data = pcall(lib.process.run, { "pipenv", "--py" }, { stdout = true })
|
||||||
if success then
|
if success and exit_code == 0 then
|
||||||
local venv = data.stdout:gsub("\n", "")
|
local venv = data.stdout:gsub("\n", "")
|
||||||
if venv then
|
if venv then
|
||||||
python_command_mem[root] = { Path:new(venv).filename }
|
python_command_mem[root] = { Path:new(venv).filename }
|
||||||
@@ -54,12 +54,12 @@ function M.get_python_command(root)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if lib.files.exists("pyproject.toml") then
|
if lib.files.exists("pyproject.toml") then
|
||||||
local success, _, data = pcall(
|
local success, exit_code, data = pcall(
|
||||||
lib.process.run,
|
lib.process.run,
|
||||||
{ "poetry", "env", "info", "-p" },
|
{ "poetry", "env", "info", "-p" },
|
||||||
{ stdout = true }
|
{ stdout = true }
|
||||||
)
|
)
|
||||||
if success then
|
if success and exit_code == 0 then
|
||||||
local venv = data.stdout:gsub("\n", "")
|
local venv = data.stdout:gsub("\n", "")
|
||||||
if venv then
|
if venv then
|
||||||
python_command_mem[root] = { Path:new(venv, "bin", "python").filename }
|
python_command_mem[root] = { Path:new(venv, "bin", "python").filename }
|
||||||
|
Reference in New Issue
Block a user