Moved luadebug to the new structure as well

This commit is contained in:
2025-10-26 13:01:40 +01:00
parent abedca2394
commit 92fd3cabf8
4 changed files with 175 additions and 87 deletions

View File

@ -1,30 +1,12 @@
local core = require "core"
local process = require "process"
local debugger = require "plugins.jpdebug.debugger"
---@class shell: runner
local shell = {
local shell = debugger.runner:new({
name = "shell",
proc = nil ---@type process|nil
}
function shell:new(o)
o = o or {}
setmetatable(o, self)
self.__index = self
return o
end
---@meta
function shell.log(msg) end
---@meta
function shell.error(msg) end
---@meta
function shell.stdout(msg) end
---@meta
function shell.stderr(msg) end
---@meta
function shell.exited() end
})
function shell:run(target, name)
local opts = {
@ -51,11 +33,12 @@ function shell:run(target, name)
local sout = self.proc:read_stdout()
local serr = self.proc:read_stderr()
if sout == nil and serr == nil then
self.exited()
local exitcode = self.proc:wait(process.WAIT_INFINITE)
self.on_exit(exitcode)
break
end
if sout and sout~="" then self.stdout(sout) end
if serr and serr~="" then self.stderr(serr) end
if sout and sout~="" then self.on_stdout(sout) end
if serr and serr~="" then self.on_stderr(serr) end
end
end)
end