busted icon indicating copy to clipboard operation
busted copied to clipboard

If lua, quoted arguments loose quote

Open brunotvs opened this issue 11 months ago • 0 comments

Problem: running busted -e "print('hello')" . works but busted -e "print('hello')" --lua "lua" . doesn't.

Solution: quote args at if lua and not ignore-lua

-- busted/modules/cli.lua: 214
if cliArgs['lua'] and not cliArgs['ignore-lua'] then
  local quoted = {}
  for _, arg in ipairs(args) do
    local a = arg:gsub('"', '\\"')
    table.insert(quoted, a)
  end
  local end_args = ''
  if #quoted >0 then
    end_args = '"' .. table.concat(quoted,'" "') .. '"'
  end
  local _, code = execute(
    cliArgs["lua"] .. " " .. args[0] .. ' --ignore-lua ' .. end_args
  )
  exit(code)
end

brunotvs avatar Jan 04 '25 23:01 brunotvs