mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-22 02:53:09 +00:00
pass the inject code error to debug_console
This commit is contained in:
@@ -52,9 +52,9 @@ local function init(skynet, export)
|
||||
|
||||
function dbgcmd.RUN(source, filename)
|
||||
local inject = require "skynet.inject"
|
||||
local output = inject(skynet, source, filename , export.dispatch, skynet.register_protocol)
|
||||
local ok, output = inject(skynet, source, filename , export.dispatch, skynet.register_protocol)
|
||||
collectgarbage "collect"
|
||||
skynet.ret(skynet.pack(table.concat(output, "\n")))
|
||||
skynet.ret(skynet.pack(ok, table.concat(output, "\n")))
|
||||
end
|
||||
|
||||
function dbgcmd.TERM(service)
|
||||
|
||||
@@ -54,12 +54,13 @@ return function(skynet, source, filename , ...)
|
||||
local env = setmetatable( { print = print , _U = u, _P = p}, { __index = _ENV })
|
||||
local func, err = load(source, filename, "bt", env)
|
||||
if not func then
|
||||
return { err }
|
||||
return false, { err }
|
||||
end
|
||||
local ok, err = skynet.pcall(func)
|
||||
if not ok then
|
||||
table.insert(output, err)
|
||||
return false, output
|
||||
end
|
||||
|
||||
return output
|
||||
return true, output
|
||||
end
|
||||
|
||||
@@ -242,7 +242,11 @@ function COMMAND.inject(address, filename)
|
||||
end
|
||||
local source = f:read "*a"
|
||||
f:close()
|
||||
return skynet.call(address, "debug", "RUN", source, filename)
|
||||
local ok, output = skynet.call(address, "debug", "RUN", source, filename)
|
||||
if ok == false then
|
||||
error(output)
|
||||
end
|
||||
return output
|
||||
end
|
||||
|
||||
function COMMAND.task(address)
|
||||
|
||||
Reference in New Issue
Block a user