Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions doc/dap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ For `pipe` the following options are supported:
cwd?: string -- Working directory
}

options?: {
timeout?: integer -- Max amount of time in ms to wait between spawning
-- the executable and connecting to the pipe. This
-- gives the executable time to create the pipe.
-- Defaults to 5000ms
}


All types support the following additional options:

Expand Down
5 changes: 5 additions & 0 deletions lua/dap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,15 @@ local DAP_QUICKFIX_CONTEXT = DAP_QUICKFIX_TITLE
---@field executable nil|ServerAdapterExecutable
---@field options nil|ServerOptions


---@class DapPipeOptions
---@field timeout? integer max amount of time in ms to wait between spawning the executable and connecting. This gives the executable time to create the pipe. Defaults to 5000

---@class PipeAdapter : Adapter
---@field type "pipe"
---@field pipe string absolute path to the pipe or ${pipe} to use random tmp path
---@field executable? ServerAdapterExecutable
---@field options? DapPipeOptions

---@class ServerAdapterExecutable
---@field command string
Expand Down
5 changes: 4 additions & 1 deletion lua/dap/session.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,10 @@ function Session.pipe(adapter, opts, on_connect)
log.debug(
"Debug adapter server executable started with pipe " .. adapter.pipe)
-- The adapter should create the pipe
vim.wait(5000, function()

local adapter_opts = adapter.options or {}
local timeout = adapter_opts.timeout or 5000
vim.wait(timeout, function()
return uv.fs_stat(adapter.pipe) ~= nil
end)
end
Expand Down