From a75d447e10bb7842cdbed0bb494697ddd88fd455 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Wed, 21 Feb 2024 01:23:59 -0300 Subject: fix: handle error if test.command is not a string. Fixes #1055. --- src/luarocks/test/command.lua | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/luarocks/test/command.lua b/src/luarocks/test/command.lua index afdb5cb6..bed6744e 100644 --- a/src/luarocks/test/command.lua +++ b/src/luarocks/test/command.lua @@ -27,12 +27,18 @@ function command.run_tests(test, args) local ok if test.script then + if type(test.script) ~= "string" then + return nil, "Malformed rockspec: 'script' expects a string" + end if not fs.exists(test.script) then return nil, "Test script " .. test.script .. " does not exist" end local lua = fs.Q(cfg.variables["LUA"]) -- get lua interpreter configured ok = fs.execute(lua, test.script, unpack(args)) elseif test.command then + if type(test.command) ~= "string" then + return nil, "Malformed rockspec: 'command' expects a string" + end ok = fs.execute(test.command, unpack(args)) end -- cgit v1.2.3-55-g6feb