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

the comand line argument with space will be split when use --lua #728

Open
zhanlangorz opened this issue Aug 17, 2023 · 0 comments
Open

Comments

@zhanlangorz
Copy link

zhanlangorz commented Aug 17, 2023

I need to use resty to run busted, so i use the lua options in .busted configure file like this.

return {

  default = {
    lua = "spec/resty_runner.lua",
  },
}

the spec/resty_runner file content is:

local RESTY_FLAGS = os.getenv("BUSTED_RESTY_FLAGS") or "-e 'setmetatable(_G, nil)'"
local json = require("cjson")
print(json.encode(arg))

-- rebuild the invoked commandline, while inserting extra resty-flags
local cmd = {
    "exec",
    arg[-1],
    "--shdict='tapis_inner_cache 10m'",
    "--shdict='app_cache 10m'",
    "--shdict='local_cache_ipc 10m'",
    RESTY_FLAGS,
}
for i, param in ipairs(arg) do
    table.insert(cmd, "'" .. param .. "'")
end

local _, _, rc = os.execute(table.concat(cmd, " "))
os.exit(rc)

Then i run busted like this: busted '--filter' 'get_subscribe_anchors get success'

The arg on spec/resty_runner print

{"0":"spec\/resty_runner.lua","1":"\/usr\/local\/lib\/luarocks\/rocks-5.1\/busted\/2.1.1-1\/bin\/busted","2":"--ignore-lua","3":"--filter","4":"get_subscribe_anchors","5":"get","6":"success","-1":"\/usr\/bin\/resty"}`

The --filter option value become: "4":"get_subscribe_anchors","5":"get","6":"success"

But the true one is 'get_subscribe_anchors get success'

So, how to get the true option value with space in my spec/resty_runner?

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

No branches or pull requests

1 participant