dearikomaru
New Coder
Code:
Lua:
function func.execute(command)
local f = io.popen(command .. ' 2>&1 && echo " $?"')
local output = assert(f:read "*a")
local tempOutput = output
local begin, _, code = output:find " (%d+)\n$"
if begin == nil or begin == '' then
output = table.concat(func.strSplit('\n', tempOutput), "|.|")
else
output, code = output:sub(1, begin - 1), tonumber(code)
end
return code == 0 and true or false, code, output
end