diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2024-02-16 23:41:43 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2024-02-17 02:42:24 -0300 |
| commit | 882c7b1ff2df7a7b05f42eb0ba6f781d9ccfe5fe (patch) | |
| tree | e471d8fc05c8cc951baa3a8c7fefea1af62ea6ed | |
| parent | d74be10615b331aa932189343c9cf33be7feaaed (diff) | |
| download | luarocks-882c7b1ff2df7a7b05f42eb0ba6f781d9ccfe5fe.tar.gz luarocks-882c7b1ff2df7a7b05f42eb0ba6f781d9ccfe5fe.tar.bz2 luarocks-882c7b1ff2df7a7b05f42eb0ba6f781d9ccfe5fe.zip | |
fix: handle error when failing to create local_cache
Closes #1514.
Co-Authored-By: FractalU <r.beckmann@protonmail.com>
| -rw-r--r-- | src/luarocks/fetch.lua | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/luarocks/fetch.lua b/src/luarocks/fetch.lua index 09f7a40b..24b3e1e5 100644 --- a/src/luarocks/fetch.lua +++ b/src/luarocks/fetch.lua | |||
| @@ -36,6 +36,9 @@ function fetch.fetch_caching(url, mirroring) | |||
| 36 | local lock = ok and fs.lock_access(cache_dir) | 36 | local lock = ok and fs.lock_access(cache_dir) |
| 37 | if not (ok and lock) then | 37 | if not (ok and lock) then |
| 38 | cfg.local_cache = fs.make_temp_dir("local_cache") | 38 | cfg.local_cache = fs.make_temp_dir("local_cache") |
| 39 | if not cfg.local_cache then | ||
| 40 | return nil, "Failed creating temporary local_cache directory" | ||
| 41 | end | ||
| 39 | cache_dir = dir.path(cfg.local_cache, name) | 42 | cache_dir = dir.path(cfg.local_cache, name) |
| 40 | ok = fs.make_dir(cache_dir) | 43 | ok = fs.make_dir(cache_dir) |
| 41 | if not ok then | 44 | if not ok then |
| @@ -209,7 +212,9 @@ function fetch.fetch_url_at_temp_dir(url, tmpname, filename, cache) | |||
| 209 | file = dir.path(temp_dir, filename) | 212 | file = dir.path(temp_dir, filename) |
| 210 | fs.copy(cachefile, file) | 213 | fs.copy(cachefile, file) |
| 211 | end | 214 | end |
| 212 | else | 215 | end |
| 216 | |||
| 217 | if not file then | ||
| 213 | file, err, errcode = fetch.fetch_url(url, filename, cache) | 218 | file, err, errcode = fetch.fetch_url(url, filename, cache) |
| 214 | end | 219 | end |
| 215 | 220 | ||
