Added ability to switch between printing stdout and stderr in error messages

This commit is contained in:
2025-03-06 17:59:13 +11:00
parent 667151b1b6
commit 40ea3caf2a

View File

@@ -84,11 +84,11 @@ local function compile(CXX, src_dirs, include_dirs, defines, additional_argument
argv[#argv+1] = args argv[#argv+1] = args
end end
local ec, stdout = platform.exec_parallel(CXX, config.max_parallel, argv) local ec, stdout, stderr = platform.exec_parallel(CXX, config.max_parallel, argv)
for i,ec in pairs(ec) do for i,ec in pairs(ec) do
if (ec ~= 0) then if (ec ~= 0) then
print("Command \"" .. CXX .. " " .. table.concat(argv[i], " ") .. "\" failed with exit code " .. tostring(ec) .. " and output;") print("Command \"" .. CXX .. " " .. table.concat(argv[i], " ") .. "\" failed with exit code " .. tostring(ec) .. " and output;")
print(stdout[i]) if (#stderr ~= 0) then print(stderr[i]) else print(stdout[i]) end
print() print()
end end
end end
@@ -100,10 +100,10 @@ local function link(LNK, obj_dirs, library_dirs, linker_inputs, additional_argum
for _,v in pairs(linker_inputs) do argv[#argv+1] = "-l\"" .. v .. "\"" end for _,v in pairs(linker_inputs) do argv[#argv+1] = "-l\"" .. v .. "\"" end
for _,v in pairs(additional_arguments) do argv[#argv+1] = v end for _,v in pairs(additional_arguments) do argv[#argv+1] = v end
local ec, stdout = platform.exec(LNK, argv) local ec, stdout, stderr = platform.exec(LNK, argv)
if (ec ~= 0) then if (ec ~= 0) then
print("Command \"" .. LNK .. " " .. table.concat(argv) .. "\" failed with exit code " .. tostring(ec) .. " and output;") print("Command \"" .. LNK .. " " .. table.concat(argv) .. "\" failed with exit code " .. tostring(ec) .. " and output;")
print(stdout) if (#stderr ~= 0) then print(stderr[i]) else print(stdout[i]) end
print() print()
end end
end end