Skip to content

Commit 6ae8a14

Browse files
committed
Allow to configure max wait timeout for pipe adapter
5000ms can be too short. See #1147
1 parent 405df1d commit 6ae8a14

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

doc/dap.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,13 @@ For `pipe` the following options are supported:
150150
cwd?: string -- Working directory
151151
}
152152

153+
options?: {
154+
timeout?: integer -- Max amount of time in ms to wait between spawning
155+
-- the executable and connecting to the pipe. This
156+
-- gives the executable time to create the pipe.
157+
-- Defaults to 5000ms
158+
}
159+
153160

154161
All types support the following additional options:
155162

lua/dap.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,15 @@ local DAP_QUICKFIX_CONTEXT = DAP_QUICKFIX_TITLE
193193
---@field executable nil|ServerAdapterExecutable
194194
---@field options nil|ServerOptions
195195

196+
197+
---@class DapPipeOptions
198+
---@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
199+
196200
---@class PipeAdapter : Adapter
197201
---@field type "pipe"
198202
---@field pipe string absolute path to the pipe or ${pipe} to use random tmp path
199203
---@field executable? ServerAdapterExecutable
204+
---@field options? DapPipeOptions
200205

201206
---@class ServerAdapterExecutable
202207
---@field command string

lua/dap/session.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1252,7 +1252,10 @@ function Session.pipe(adapter, opts, on_connect)
12521252
log.debug(
12531253
"Debug adapter server executable started with pipe " .. adapter.pipe)
12541254
-- The adapter should create the pipe
1255-
vim.wait(5000, function()
1255+
1256+
local adapter_opts = adapter.options or {}
1257+
local timeout = adapter_opts.timeout or 5000
1258+
vim.wait(timeout, function()
12561259
return uv.fs_stat(adapter.pipe) ~= nil
12571260
end)
12581261
end

0 commit comments

Comments
 (0)