Skip to content

Commit

Permalink
fix: quoting args if lua directive and not --ignore-lua
Browse files Browse the repository at this point in the history
  • Loading branch information
brunotvs committed Jan 5, 2025
1 parent a144124 commit 673f028
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion busted/modules/cli.lua
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,17 @@ return function(options)
-- Switch lua, we should rebuild this feature once luarocks changes how it
-- handles executeable lua files.
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 '..table.concat(args, ' ')
cliArgs["lua"] .. " " .. args[0] .. ' --ignore-lua ' .. end_args
)
exit(code)
end
Expand Down

0 comments on commit 673f028

Please sign in to comment.