diff options
| author | Chi Huu Huynh <[email protected]> | 2024-06-04 11:32:33 +0100 |
|---|---|---|
| committer | Chi Huu Huynh <[email protected]> | 2024-06-04 11:32:33 +0100 |
| commit | 6b478b7c5acba7ff17a9ee3df2ee979e65e1a208 (patch) | |
| tree | de26a55f73d2e8356ee127b752a9d90dcc84916a | |
| parent | 0f43f1c1503410ad099420954e6f4a701e885f60 (diff) | |
add timeout to net.http.download
| -rw-r--r-- | xmake/modules/net/http/download.lua | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/xmake/modules/net/http/download.lua b/xmake/modules/net/http/download.lua index 9ef9ec0a0..d622e75d9 100644 --- a/xmake/modules/net/http/download.lua +++ b/xmake/modules/net/http/download.lua @@ -99,6 +99,12 @@ function _curl_download(tool, url, outputfile, opt) table.insert(argv, "-") end + -- set timeout + if opt.timeout then + table.insert(argv, "--max-time") + table.insert(argv, tostring(opt.timeout)) + end + -- set url table.insert(argv, url) @@ -170,6 +176,11 @@ function _wget_download(tool, url, outputfile, opt) table.insert(argv, "-c") end + -- set timeout + if opt.timeout then + table.insert(argv, "--timeout=" .. tostring(opt.timeout)) + end + -- set outputfile table.insert(argv, "-O") table.insert(argv, outputfile) |
