diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/luarocks/fs/lua.lua | 12 | ||||
-rw-r--r-- | src/luarocks/fs/tools.lua | 6 |
2 files changed, 10 insertions, 8 deletions
diff --git a/src/luarocks/fs/lua.lua b/src/luarocks/fs/lua.lua index 4016ddcd..fdf3af78 100644 --- a/src/luarocks/fs/lua.lua +++ b/src/luarocks/fs/lua.lua | |||
@@ -936,14 +936,16 @@ local downloader_warning = false | |||
936 | -- resulting local filename of the remote file as the basename of the URL; | 936 | -- resulting local filename of the remote file as the basename of the URL; |
937 | -- if that is not correct (due to a redirection, for example), the local | 937 | -- if that is not correct (due to a redirection, for example), the local |
938 | -- filename can be given explicitly as this second argument. | 938 | -- filename can be given explicitly as this second argument. |
939 | -- @return (boolean, string, boolean): | 939 | -- @return (string, string, string, boolean): |
940 | -- In case of success: | 940 | -- In case of success: |
941 | -- * true | 941 | -- * name |
942 | -- * a string with the filename | 942 | -- nil |
943 | -- nil | ||
943 | -- * true if the file was retrieved from local cache | 944 | -- * true if the file was retrieved from local cache |
944 | -- In case of failure: | 945 | -- In case of failure: |
945 | -- * false | 946 | -- nil |
946 | -- * error message | 947 | -- * error message |
948 | -- * error code | ||
947 | function fs_lua.download(url, filename, cache) | 949 | function fs_lua.download(url, filename, cache) |
948 | assert(type(url) == "string") | 950 | assert(type(url) == "string") |
949 | assert(type(filename) == "string" or not filename) | 951 | assert(type(filename) == "string" or not filename) |
@@ -984,7 +986,7 @@ function fs_lua.download(url, filename, cache) | |||
984 | elseif not ok then | 986 | elseif not ok then |
985 | return nil, err, "network" | 987 | return nil, err, "network" |
986 | end | 988 | end |
987 | return true, filename, from_cache | 989 | return filename, nil, nil, from_cache |
988 | end | 990 | end |
989 | 991 | ||
990 | else --...if socket_ok == false then | 992 | else --...if socket_ok == false then |
diff --git a/src/luarocks/fs/tools.lua b/src/luarocks/fs/tools.lua index 23f2561e..b7d03759 100644 --- a/src/luarocks/fs/tools.lua +++ b/src/luarocks/fs/tools.lua | |||
@@ -148,7 +148,7 @@ end | |||
148 | -- filename can be given explicitly as this second argument. | 148 | -- filename can be given explicitly as this second argument. |
149 | -- @param cache boolean: compare remote timestamps via HTTP HEAD prior to | 149 | -- @param cache boolean: compare remote timestamps via HTTP HEAD prior to |
150 | -- re-downloading the file. | 150 | -- re-downloading the file. |
151 | -- @return (boolean, string, string): true and the filename on success, | 151 | -- @return (string, string, string): filename on success, |
152 | -- false and the error message and code on failure. | 152 | -- false and the error message and code on failure. |
153 | function tools.use_downloader(url, filename, cache) | 153 | function tools.use_downloader(url, filename, cache) |
154 | assert(type(url) == "string") | 154 | assert(type(url) == "string") |
@@ -190,10 +190,10 @@ function tools.use_downloader(url, filename, cache) | |||
190 | ok = fs.execute_string(fs.quiet_stderr(curl_cmd..fs.Q(url).." --output "..fs.Q(filename))) | 190 | ok = fs.execute_string(fs.quiet_stderr(curl_cmd..fs.Q(url).." --output "..fs.Q(filename))) |
191 | end | 191 | end |
192 | if ok then | 192 | if ok then |
193 | return true, filename | 193 | return filename |
194 | else | 194 | else |
195 | os.remove(filename) | 195 | os.remove(filename) |
196 | return false, "failed downloading " .. url, "network" | 196 | return nil, "failed downloading " .. url, "network" |
197 | end | 197 | end |
198 | end | 198 | end |
199 | 199 | ||