Added ability to switch between printing stdout and stderr in error messages
This commit is contained in:
8
lbs.lua
8
lbs.lua
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user