fix: detect poetry env outside of poetry shell (#49)

If you are not in a `poetry shell`, the venv detection does not work. This patch
prepends `poetry run` before `poetry env info -p`, which makes venv detection
work both inside and outside the poetry subshell.
This commit is contained in:
Sebastian Kohn
2023-07-04 21:45:45 +02:00
committed by GitHub
parent 6c06041cfb
commit 054f221294

View File

@@ -56,7 +56,7 @@ function M.get_python_command(root)
if lib.files.exists("pyproject.toml") then
local success, exit_code, data = pcall(
lib.process.run,
{ "poetry", "env", "info", "-p" },
{ "poetry", "run", "poetry", "env", "info", "-p" },
{ stdout = true }
)
if success and exit_code == 0 then