diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/luarocks/cmd/init.lua | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/luarocks/cmd/init.lua b/src/luarocks/cmd/init.lua index b5161a9f..b5359c96 100644 --- a/src/luarocks/cmd/init.lua +++ b/src/luarocks/cmd/init.lua | |||
@@ -46,13 +46,15 @@ local function write_gitignore(entries) | |||
46 | end | 46 | end |
47 | 47 | ||
48 | fd = io.open(".gitignore", gitignore and "a" or "w") | 48 | fd = io.open(".gitignore", gitignore and "a" or "w") |
49 | for _, entry in ipairs(entries) do | 49 | if fd then |
50 | entry = "/" .. entry | 50 | for _, entry in ipairs(entries) do |
51 | if not gitignore:find("\n"..entry.."\n", 1, true) then | 51 | entry = "/" .. entry |
52 | fd:write(entry.."\n") | 52 | if not gitignore:find("\n"..entry.."\n", 1, true) then |
53 | fd:write(entry.."\n") | ||
54 | end | ||
53 | end | 55 | end |
56 | fd:close() | ||
54 | end | 57 | end |
55 | fd:close() | ||
56 | end | 58 | end |
57 | 59 | ||
58 | local function inject_tree(tree) | 60 | local function inject_tree(tree) |