diff options
-rw-r--r-- | src/luarocks/fetch.lua | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/luarocks/fetch.lua b/src/luarocks/fetch.lua index 435108ae..193e5e39 100644 --- a/src/luarocks/fetch.lua +++ b/src/luarocks/fetch.lua | |||
@@ -62,15 +62,20 @@ function fetch.fetch_caching(url, mirroring) | |||
62 | end | 62 | end |
63 | 63 | ||
64 | local file, err, errcode, from_cache = fetch.fetch_url(url, cachefile, true, mirroring) | 64 | local file, err, errcode, from_cache = fetch.fetch_url(url, cachefile, true, mirroring) |
65 | if not file then | ||
66 | fs.unlock_access(lock) | ||
67 | return nil, err or "Failed downloading "..url, errcode | ||
68 | end | ||
65 | 69 | ||
66 | local fd = io.open(checkfile, "wb") | 70 | local fd, err = io.open(checkfile, "wb") |
71 | if err then | ||
72 | fs.unlock_access(lock) | ||
73 | return nil, err | ||
74 | end | ||
67 | fd:write("!") | 75 | fd:write("!") |
68 | fd:close() | 76 | fd:close() |
69 | 77 | ||
70 | fs.unlock_access(lock) | 78 | fs.unlock_access(lock) |
71 | if not file then | ||
72 | return nil, err or "Failed downloading "..url, errcode | ||
73 | end | ||
74 | return file, nil, nil, from_cache | 79 | return file, nil, nil, from_cache |
75 | end | 80 | end |
76 | 81 | ||