text stringlengths 0 834k |
|---|
dst[i] = ""null"" |
elseif typ == ""table"" then |
dst[i] = expand_table(arg, false) |
elseif typ ~= ""string"" then |
dst[i] = tostring(arg) |
else |
dst[i] = arg |
end |
end |
return concat(dst) |
end |
local function output(...) |
local args = {...} |
return stdout:write(expand_table(args, true)) |
end |
ngx.orig_print = ngx.print |
ngx.print = output |
ngx.orig_say = ngx.say |
ngx.say = function (...) |
local ok, err = output(...) |
if ok then |
return output(""\\n"") |
end |
return ok, err |
end |
print = ngx.say |
ngx.flush = function (...) return stdout:flush() end |
-- we cannot close stdout here due to a bug in Lua: |
ngx.eof = function (...) return true end |
ngx.exit = os.exit |
} |
init_worker_by_lua_block { |
local exit = os.exit |
local stderr = io.stderr |
local ffi = require ""ffi"" |
local function handle_err(err) |
if err then |
err = string.gsub(err, ""^init_worker_by_lua:%d+: "", """") |
stderr:write(""ERROR: "", err, ""\\n"") |
end |
return exit(1) |
end |
local ok, err = pcall(function () |
if not ngx.config |
or not ngx.config.ngx_lua_version |
or ngx.config.ngx_lua_version < 10009 |
then |
error(""at least ngx_lua 0.10.9 is required"") |
end |
local signal_graceful_exit = |
require(""ngx.process"").signal_graceful_exit |
if not signal_graceful_exit then |
error(""lua-resty-core library is too old; "" |
.. ""missing the signal_graceful_exit() function "" |
.. ""in ngx.process"") |
end |
$loader |
-- print(""calling timer.at..."") |
local ok, err = ngx.timer.at(0, function () |
-- io.stderr:write(""timer firing"") |
local ok, err = xpcall(gen, function (err) |
-- level 3: we skip this function and the |
-- error() call itself in our stacktrace |
local trace = debug.traceback(err, 3) |
return handle_err(trace) |
end) |
if not ok then |
return handle_err(err) |
end |
if ffi.abi(""win"") then |
return exit(0) |
end |
signal_graceful_exit() |
end) |
if not ok then |
return handle_err(err) |
end |
-- print(""timer created"") |
end) |
if not ok then |
return handle_err(err) |
end |
} |
} |
_EOC_ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.