mirror of
https://github.com/openresty/openresty.git
synced 2024-10-13 00:29:41 +00:00
resty: made ngx.print, ngx.say, and print return meaninful values; also mocked ngx.flush() and ngx.eof().
This commit is contained in:
parent
fae163cc70
commit
59e6665224
@ -127,9 +127,12 @@ http {
|
|||||||
|
|
||||||
init_by_lua '
|
init_by_lua '
|
||||||
local stdout = io.stdout
|
local stdout = io.stdout
|
||||||
print = function (...) stdout:write(...) end
|
print = function (...) return stdout:write(...) end
|
||||||
ngx.print = print
|
ngx.print = print
|
||||||
ngx.say = function (...) print(...) print("\\\\n") end
|
ngx.say = function (...) local ok, err = print(...) if ok then return print("\\\\n") end return ok, err end
|
||||||
|
ngx.flush = function (...) return stdout:flush() end
|
||||||
|
-- we cannot close stdout here due to a bug in Lua:
|
||||||
|
ngx.eof = function (...) return true end
|
||||||
';
|
';
|
||||||
|
|
||||||
init_worker_by_lua '
|
init_worker_by_lua '
|
||||||
|
Loading…
x
Reference in New Issue
Block a user