diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2014-04-03 11:15:09 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2014-04-03 11:15:09 -0300 |
| commit | 63820f899cf8f35b2274b04e76b15b168213bd33 (patch) | |
| tree | 14941e45e1e4c6f542f4fc69250e6364d2b9d1bc | |
| parent | 489b99032f06cbdd67745be859098a10019dfad0 (diff) | |
| download | luarocks-63820f899cf8f35b2274b04e76b15b168213bd33.tar.gz luarocks-63820f899cf8f35b2274b04e76b15b168213bd33.tar.bz2 luarocks-63820f899cf8f35b2274b04e76b15b168213bd33.zip | |
Add -k flag so that curl behavior matches that of wget.
Also, make win32 and unix code more similar (we're almost to the point where we could have a single implementation for both!)
| -rw-r--r-- | src/luarocks/fs/unix/tools.lua | 10 | ||||
| -rw-r--r-- | src/luarocks/fs/win32/tools.lua | 8 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/luarocks/fs/unix/tools.lua b/src/luarocks/fs/unix/tools.lua index d381b8d9..aadb9b07 100644 --- a/src/luarocks/fs/unix/tools.lua +++ b/src/luarocks/fs/unix/tools.lua | |||
| @@ -246,20 +246,20 @@ function tools.download(url, filename, cache) | |||
| 246 | 246 | ||
| 247 | local ok | 247 | local ok |
| 248 | if cfg.downloader == "wget" then | 248 | if cfg.downloader == "wget" then |
| 249 | local wget_cmd = vars.WGET.." --no-check-certificate --no-cache --user-agent='"..cfg.user_agent.." via wget' --quiet " | 249 | local wget_cmd = fs.Q(vars.WGET).." --no-check-certificate --no-cache --user-agent='"..cfg.user_agent.." via wget' --quiet " |
| 250 | if cache then | 250 | if cache then |
| 251 | -- --timestamping is incompatible with --output-document, | 251 | -- --timestamping is incompatible with --output-document, |
| 252 | -- but that's not a problem for our use cases. | 252 | -- but that's not a problem for our use cases. |
| 253 | fs.change_dir(dir.dir_name(filename)) | 253 | fs.change_dir(dir.dir_name(filename)) |
| 254 | ok = fs.execute(wget_cmd.." --timestamping ", url) | 254 | ok = fs.execute_quiet(wget_cmd.." --timestamping ", url) |
| 255 | fs.pop_dir() | 255 | fs.pop_dir() |
| 256 | elseif filename then | 256 | elseif filename then |
| 257 | ok = fs.execute(wget_cmd.." --output-document "..fs.Q(filename), url) | 257 | ok = fs.execute_quiet(wget_cmd.." --output-document ", filename, url) |
| 258 | else | 258 | else |
| 259 | ok = fs.execute(wget_cmd, url) | 259 | ok = fs.execute_quiet(wget_cmd, url) |
| 260 | end | 260 | end |
| 261 | elseif cfg.downloader == "curl" then | 261 | elseif cfg.downloader == "curl" then |
| 262 | ok = fs.execute_string(vars.CURL.." -f -L --user-agent '"..cfg.user_agent.." via curl' "..fs.Q(url).." 2> /dev/null 1> "..fs.Q(filename)) | 262 | ok = fs.execute_string(fs.Q(vars.CURL).." -f -k -L --user-agent '"..cfg.user_agent.." via curl' "..fs.Q(url).." 2> /dev/null 1> "..fs.Q(filename)) |
| 263 | end | 263 | end |
| 264 | if ok then | 264 | if ok then |
| 265 | return true, filename | 265 | return true, filename |
diff --git a/src/luarocks/fs/win32/tools.lua b/src/luarocks/fs/win32/tools.lua index bd7ba086..fbd8b6e4 100644 --- a/src/luarocks/fs/win32/tools.lua +++ b/src/luarocks/fs/win32/tools.lua | |||
| @@ -261,15 +261,15 @@ function tools.download(url, filename, cache) | |||
| 261 | -- --timestamping is incompatible with --output-document, | 261 | -- --timestamping is incompatible with --output-document, |
| 262 | -- but that's not a problem for our use cases. | 262 | -- but that's not a problem for our use cases. |
| 263 | fs.change_dir(dir.dir_name(filename)) | 263 | fs.change_dir(dir.dir_name(filename)) |
| 264 | ok = fs.execute(wget_cmd.." --timestamping "..fs.Q(url).." 2> NUL 1> NUL") | 264 | ok = fs.execute_quiet(wget_cmd.." --timestamping ", url) |
| 265 | fs.pop_dir() | 265 | fs.pop_dir() |
| 266 | elseif filename then | 266 | elseif filename then |
| 267 | ok = fs.execute(wget_cmd.." --output-document "..fs.Q(filename).." "..fs.Q(url).." 2> NUL 1> NUL") | 267 | ok = fs.execute_quiet(wget_cmd.." --output-document ", filename, url) |
| 268 | else | 268 | else |
| 269 | ok = fs.execute(wget_cmd..fs.Q(url).." 2> NUL 1> NUL") | 269 | ok = fs.execute_quiet(wget_cmd, url) |
| 270 | end | 270 | end |
| 271 | elseif cfg.downloader == "curl" then | 271 | elseif cfg.downloader == "curl" then |
| 272 | ok = fs.execute_string(fs.Q(vars.CURL).." -f -L --user-agent \""..cfg.user_agent.." via curl\" "..fs.Q(url).." 2> NUL 1> "..fs.Q(filename)) | 272 | ok = fs.execute_string(fs.Q(vars.CURL).." -f -k -L --user-agent \""..cfg.user_agent.." via curl\" "..fs.Q(url).." 2> NUL 1> "..fs.Q(filename)) |
| 273 | end | 273 | end |
| 274 | if ok then | 274 | if ok then |
| 275 | return true, filename | 275 | return true, filename |
