Skip to content

Commit c53bd6e

Browse files
committed
fix(dap): bound the debugpy import probe with a timeout
The probe runs synchronously on the :Dap* setup tick; a hung interpreter (dead network FS, broken shim) would block the editor indefinitely. wait(5000) SIGKILLs the probe on timeout with exit code 124 (:h SystemObj:wait()), which the existing non-zero check already treats as a failed probe, so resolution falls through to the remaining candidates.
1 parent 6df2354 commit c53bd6e

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

lua/modules/configs/tool/dap/clients/python.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,12 @@ return function()
121121
-- vim.system, not vim.fn.system: the exit code stays local
122122
-- instead of round-tripping through the v:shell_error global
123123
-- (repo convention — core/pack.lua, servers/gopls.lua).
124-
if vim.system({ probe_cmd, "-c", "import debugpy" }):wait().code == 0 then
124+
-- Bounded wait: this runs synchronously on the :Dap* setup
125+
-- tick, and a hung interpreter (dead network FS, broken
126+
-- shim) would otherwise freeze the editor. On timeout the
127+
-- probe is SIGKILLed with code 124 — a failed probe, so
128+
-- resolution falls through to the remaining candidates.
129+
if vim.system({ probe_cmd, "-c", "import debugpy" }):wait(5000).code == 0 then
125130
-- Spawn by the probed exepath, not its realpath: a venv python is a
126131
-- symlink and pyvenv.cfg discovery precedes symlink resolution.
127132
return found(probe_cmd, { "-m", "debugpy.adapter" })

0 commit comments

Comments
 (0)