Moved luadebug to the new structure as well
This commit is contained in:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user