Fix os.outputof for lua 5.3.4

This commit is contained in:
Tom van Dijck 2017-06-13 06:53:13 -07:00
parent 7d503ad511
commit 971f7b58dc

View File

@ -61,7 +61,7 @@
end
return dirs
end
local function get_library_search_path()
local path
if os.istarget("windows") then
@ -151,14 +151,14 @@
function os.findheader(headerpath, headerdirs)
-- headerpath: a partial header file path
-- headerdirs: additional header search paths
local path = get_library_search_path()
-- replace all /lib by /include
path = path .. ':'
path = path:gsub ('/lib[0-9]*([:/])', '/include%1')
path = path:gsub ('/lib[0-9]*([:/])', '/include%1')
path = path:sub (1, #path - 1)
local userpath = ""
if type(headerdirs) == "string" then
@ -174,7 +174,7 @@
path = userpath
end
end
local result = os.pathsearch (headerpath, path)
return result
end
@ -460,17 +460,17 @@
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
-- chomp trailing newlines
if result then
result = string.gsub(result, "[\r\n]+$", "")
return result, code, what
else
return nil, code, what
end
return result, exitcode
end