It's blocking apt-get update
Opened this issue · 1 comments
Deleted user commented
Hi, I have following code and was expecting line by line printing to screens instead of print all output
local shell = require "resty.shell"
local stdin = "hello"
local timeout = 1000 -- ms
local max_size = 4096 -- byte
local ok, stdout, stderr, reason, status =
shell.run([[apt-get update]], stdin, timeout, max_size)
ngx.say(ok)
ngx.say("stdout " ..stdout)
ngx.say("stderr " ..stderr)
ngx.say("reason " ..reason)
ngx.say(status)
ngx.say("Good !!")
if not ok then
ngx.say("errror")
end
zhuizhuhaomeng commented
you can use ngx.pipe instead.
see https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/pipe.md