Merge pull request #2083 from JoshuaWebb/master

Close file handles in clink.lua
This commit is contained in:
Dax T Games 2019-05-05 17:13:57 -04:00 committed by GitHub
commit 0bd847e695
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

10
vendor/clink.lua vendored
View File

@ -189,12 +189,15 @@ end
-- @return {false|mercurial branch name}
---
local function get_hg_branch()
for line in io.popen("hg branch 2>nul"):lines() do
local file = io.popen("hg branch 2>nul")
for line in file:lines() do
local m = line:match("(.+)$")
if m then
file:close()
return m
end
end
file:close()
return false
end
@ -204,12 +207,15 @@ end
-- @return {false|svn branch name}
---
local function get_svn_branch(svn_dir)
for line in io.popen("svn info 2>nul"):lines() do
local file = io.popen("svn info 2>nul")
for line in file:lines() do
local m = line:match("^Relative URL:")
if m then
file:close()
return line:sub(line:find("/")+1,line:len())
end
end
file:close()
return false
end