change: resty: print() is now identical to ngx.say(), which is more in line with the std "print" function. thanks Michal Cichra for the original patch in #65.
This commit is contained in:
parent
07913609c6
commit
b2cc655554
15
util/resty
15
util/resty
|
@ -178,13 +178,22 @@ $lua_package_path_config
|
||||||
return concat(dst)
|
return concat(dst)
|
||||||
end
|
end
|
||||||
|
|
||||||
print = function (...)
|
local function output(...)
|
||||||
local args = {...}
|
local args = {...}
|
||||||
|
|
||||||
return stdout:write(expand_table(args, true))
|
return stdout:write(expand_table(args, true))
|
||||||
end
|
end
|
||||||
ngx.print = print
|
|
||||||
ngx.say = function (...) local ok, err = print(...) if ok then return print("\\\\n") end return ok, err end
|
ngx.print = output
|
||||||
|
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
|
ngx.flush = function (...) return stdout:flush() end
|
||||||
-- we cannot close stdout here due to a bug in Lua:
|
-- we cannot close stdout here due to a bug in Lua:
|
||||||
ngx.eof = function (...) return true end
|
ngx.eof = function (...) return true end
|
||||||
|
|
Loading…
Reference in New Issue