diff options
Diffstat (limited to 'neovim/.config/nvim/lua/config/project_run.lua')
| -rw-r--r-- | neovim/.config/nvim/lua/config/project_run.lua | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/neovim/.config/nvim/lua/config/project_run.lua b/neovim/.config/nvim/lua/config/project_run.lua index 40c1795..b7c2560 100644 --- a/neovim/.config/nvim/lua/config/project_run.lua +++ b/neovim/.config/nvim/lua/config/project_run.lua | |||
| @@ -63,7 +63,12 @@ function M.python(opts) | |||
| 63 | 63 | ||
| 64 | local venv = venv_dir() | 64 | local venv = venv_dir() |
| 65 | local env = venv and venv_env(venv) or nil | 65 | local env = venv and venv_env(venv) or nil |
| 66 | local cmd = opts.module and { "python3", "-m", opts.module } or { "python3", opts.program } | 66 | -- Resolve the interpreter to the venv's own binary rather than relying on |
| 67 | -- env.PATH below: jobstart/libuv resolves a bare "python3" against the | ||
| 68 | -- *parent* process's PATH, not the child job's env, so a PATH override | ||
| 69 | -- alone silently falls through to the system interpreter. | ||
| 70 | local python = venv and (venv .. "/bin/python3") or "python3" | ||
| 71 | local cmd = opts.module and { python, "-m", opts.module } or { python, opts.program } | ||
| 67 | 72 | ||
| 68 | require("overseer").register_template({ | 73 | require("overseer").register_template({ |
| 69 | name = opts.name, | 74 | name = opts.name, |
| @@ -90,8 +95,9 @@ function M.python(opts) | |||
| 90 | -- nvim-dap-python only auto-detects an interpreter (VIRTUAL_ENV env var, | 95 | -- nvim-dap-python only auto-detects an interpreter (VIRTUAL_ENV env var, |
| 91 | -- then a venv/.venv/env/.env folder search) when pythonPath/python isn't | 96 | -- then a venv/.venv/env/.env folder search) when pythonPath/python isn't |
| 92 | -- already set - and debugpy needs the literal interpreter path here | 97 | -- already set - and debugpy needs the literal interpreter path here |
| 93 | -- regardless (it spawns it directly, not through a shell that'd resolve | 98 | -- regardless, same reason `cmd` above uses the venv binary directly |
| 94 | -- `python3` via PATH the way env.PATH above does for the overseer task). | 99 | -- rather than a bare `python3` resolved via env.PATH: it spawns the |
| 100 | -- interpreter directly, not through a shell that'd do that resolution. | ||
| 95 | -- Set it explicitly from the same .venv we already found, so debugging | 101 | -- Set it explicitly from the same .venv we already found, so debugging |
| 96 | -- doesn't depend on that separate heuristic agreeing with us - without | 102 | -- doesn't depend on that separate heuristic agreeing with us - without |
| 97 | -- this, a missed/wrong guess falls back to debugpy's own adapter venv, | 103 | -- this, a missed/wrong guess falls back to debugpy's own adapter venv, |
