lua-resty-shell icon indicating copy to clipboard operation
lua-resty-shell copied to clipboard

Nginx config from ReadMe is not valid

Open USSX-Hares opened this issue 5 years ago • 1 comments

It has closing quot-symbol in the commented lines, so co content_by_lua_block should be used instead of content_by_lua Should be:

location /test {
    content_by_lua_block
    {
        local shell = require("resty.shell")

        -- define a table to hold arguments with the following elements:
        --
        -- timeout: timeout for the socket connection
        --
        -- data: STDIN to send to sockproc
        --
        -- socket: either a table containg the elements 'host' and 'port' for tcp connections,
        -- or a string defining a unix socket
        local args = {
            socket = "unix:/tmp/shell.sock",
        }

        local status, out, err = shell.execute("uname -a", args)

        ngx.header.content_type = "text/plain"
        ngx.say("Hello from:\n" .. out)
    }
}

USSX-Hares avatar Jun 05 '19 15:06 USSX-Hares

======= TCP mode ================== status:0 123 Linux localhost.localdomain 3.10.0-1127.13.1.el7.x86_64 #1 SMP Tue Jun 23 15:46:38 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux 0 status:0 97 uid=0(root) gid=0(root) 组=0(root) 环境=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 0 status:0 22 1593922584 1593922585 0 status:0 2 2 0 status:0 14 line1 line2 0 status:32512 0 41 /bin/sh: thisshouldfail: 未找到命令 status:0 13 hello output 12 hello error status:32512 0 31 /bin/sh: 2cho: 未找到命令 ======= UNIX-socket mode ================== status:0 123 Linux localhost.localdomain 3.10.0-1127.13.1.el7.x86_64 #1 SMP Tue Jun 23 15:46:38 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux 0 status:0 97 uid=0(root) gid=0(root) 组=0(root) 环境=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 0 status:0 22 1593922586 1593922587 0 status:0 2 2 0 status:0 14 line1 line2 0 status:32512 0 41 /bin/sh: thisshouldfail: 未找到命令 status:0 13 hello output 12 hello error status:32512 0 31 /bin/sh: 2cho: 未找到命令

HumorChen avatar Jul 05 '20 04:07 HumorChen

@USSX-Hares thanks. Fixed the readme.

juce avatar Sep 28 '22 20:09 juce