mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 04:33:05 +00:00
add skynet.pcall for hotfix use (call a function with require)
This commit is contained in:
@@ -620,8 +620,10 @@ end
|
||||
local function init_all()
|
||||
local funcs = init_func
|
||||
init_func = nil
|
||||
for k,v in pairs(funcs) do
|
||||
v()
|
||||
if funcs then
|
||||
for k,v in pairs(funcs) do
|
||||
v()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -632,8 +634,12 @@ local function init_template(start)
|
||||
init_all()
|
||||
end
|
||||
|
||||
function skynet.pcall(start)
|
||||
return xpcall(init_template, debug.traceback, start)
|
||||
end
|
||||
|
||||
local function init_service(start)
|
||||
local ok, err = xpcall(init_template, debug.traceback, start)
|
||||
local ok, err = skynet.pcall(start)
|
||||
if not ok then
|
||||
skynet.error("init service failed: " .. tostring(err))
|
||||
skynet.send(".launcher","lua", "ERROR")
|
||||
|
||||
Reference in New Issue
Block a user