Added separate debugger file and fixed shell to new form

This commit is contained in:
2025-10-25 20:07:49 +02:00
parent f6c031849f
commit abedca2394
4 changed files with 148 additions and 110 deletions

View File

@ -18,7 +18,6 @@ end
local function spawn_lua_process(entry, lua, cwd, env)
local host = "localhost"
local port = 8172
local nowait = false
-- Resolve vendor/?.lua so "require('mobdebug')" finds the bundled file
local vendor_glob = join(get_plugin_root(), "vendor/?.lua")
@ -28,9 +27,8 @@ local function spawn_lua_process(entry, lua, cwd, env)
local ok, m = pcall(require, "mobdebug"); if ok then
print("Connecting to "..%q..":"..tostring(%d))
local connected = m.start(%q, %d)
if not connected and %s then m.off() end
end
]], host, port, host, port, nowait and "true" or "false")
]], host, port, host, port)
local launcher = string.format([[
package.path = %q .. ";" .. package.path
%s
@ -74,8 +72,6 @@ function LDB:run(target, name, debuginfo)
local cwd = target.cwd or "."
local env = target.env or {}
-- TODO spawn the mobdebugger
-- spawn the main lua process
local proc = spawn_lua_process(entry, lua, cwd, env)
@ -85,7 +81,7 @@ function LDB:run(target, name, debuginfo)
end
return {
luaproc=proc,
luaproc=proc
}
end
@ -96,12 +92,14 @@ end
-- Read the stdout, returns nil if process has stopped
function LDB:read_stdout(proc)
return proc.luaproc:read_stdout()
local sl = proc.luaproc:read_stdout()
return sl
end
-- Read the stderr
function LDB:read_stderr(proc)
return proc.luaproc:read_stderr()
local sl = proc.luaproc:read_stderr()
return sl
end
-- Kill the process