openresty / openresty/lua-nginx-module
No way to run command, and get both it's output and it's return code
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 11.8k
- Forks
- 2.1k
- Avg merge
- 6h 1m
- Merged PRs (30d)
- 6
Description
I need, in my lua script, to run a shell command. Then, I need to check it succeeded, using it's retval, and get it's stdout.
To achieve that, I have this code:
handler = assert(io.popen("echo my command is here"))
data = handler:read("*a")
succeeded, error_msg, retcode = handler:close()
"data" indeed gets the command output, but "succeeded" is always nil.
"error_msg" is "No child processes", and "retcode" is 10
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the Lua snippet using io.popen, handler:read("*a"), and handler:close(), recording the stdout and return values. Trace these entry points to determine whether both command output and the return code can be exposed; done means the documented behavior or implementation clearly provides both values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100