Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It's blocking apt-get update #22

Open
zesle opened this issue Feb 3, 2022 · 1 comment
Open

It's blocking apt-get update #22

zesle opened this issue Feb 3, 2022 · 1 comment

Comments

@zesle
Copy link

zesle commented Feb 3, 2022

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
Copy link
Contributor

you can use ngx.pipe instead.
see https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/pipe.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant