From 15f566a484297fa4f878fb0a63d857cfa221d887 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B3n=C3=A1n=20Carrigan?= Date: Thu, 13 Oct 2022 08:44:58 +0100 Subject: [PATCH] fix: check exit code of proc See https://github.com/nvim-neotest/neotest/issues/127 --- lua/neotest-python/base.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/neotest-python/base.lua b/lua/neotest-python/base.lua index d7e619a..9ffb300 100644 --- a/lua/neotest-python/base.lua +++ b/lua/neotest-python/base.lua @@ -43,8 +43,8 @@ function M.get_python_command(root) end if lib.files.exists("Pipfile") then - local success, _, data = pcall(lib.process.run, { "pipenv", "--py" }, { stdout = true }) - if success then + local success, exit_code, data = pcall(lib.process.run, { "pipenv", "--py" }, { stdout = true }) + if success and exit_code == 0 then local venv = data.stdout:gsub("\n", "") if venv then python_command_mem[root] = { Path:new(venv).filename } @@ -54,12 +54,12 @@ function M.get_python_command(root) end if lib.files.exists("pyproject.toml") then - local success, _, data = pcall( + local success, exit_code, data = pcall( lib.process.run, { "poetry", "env", "info", "-p" }, { stdout = true } ) - if success then + if success and exit_code == 0 then local venv = data.stdout:gsub("\n", "") if venv then python_command_mem[root] = { Path:new(venv, "bin", "python").filename }