Skip to content

Commit

Permalink
Merge pull request #2083 from JoshuaWebb/master
Browse files Browse the repository at this point in the history
Close file handles in clink.lua
  • Loading branch information
daxgames authored May 5, 2019
2 parents efe64ee + 52eea5f commit 0bd847e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions vendor/clink.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 0bd847e

Please sign in to comment.