Fix os.outputof for lua 5.3.4
local pipe = io.popen(cmd .. " 2>&1")
local result = pipe:read('*a')
- local b, exitcode = pipe:close()
- if not b then
- exitcode = -1
- end
-
+ local success, what, code = pipe:close()
+ if success then
-- chomp trailing newlines
if result then
result = string.gsub(result, "[\r\n]+$", "")
end
- return result, exitcode
+ return result, code, what
+ else
+ return nil, code, what
+ end
end
