diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2017-12-19 12:25:44 -0200 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-03-12 21:03:50 -0300 |
| commit | 0409a52f478849fb47d1793ed5a85853460d863e (patch) | |
| tree | cf5e61663e6e5c494652b1f698cd6e5a1c02e35c /src | |
| parent | 8ad159609280c1ef50e741ac44ccf5300f09b6bc (diff) | |
| download | luarocks-0409a52f478849fb47d1793ed5a85853460d863e.tar.gz luarocks-0409a52f478849fb47d1793ed5a85853460d863e.tar.bz2 luarocks-0409a52f478849fb47d1793ed5a85853460d863e.zip | |
Differentiate "not found" and "fail" when deleting.
Do not halt a deletion process when trying to delete something
that was not found.
Diffstat (limited to 'src')
| -rw-r--r-- | src/luarocks/repos.lua | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/luarocks/repos.lua b/src/luarocks/repos.lua index abc62b0d..23ed22f5 100644 --- a/src/luarocks/repos.lua +++ b/src/luarocks/repos.lua | |||
| @@ -209,12 +209,12 @@ end | |||
| 209 | local function delete_suffixed(file, suffix) | 209 | local function delete_suffixed(file, suffix) |
| 210 | local suffixed_file, err = find_suffixed(file, suffix) | 210 | local suffixed_file, err = find_suffixed(file, suffix) |
| 211 | if not suffixed_file then | 211 | if not suffixed_file then |
| 212 | return nil, "Could not remove " .. file .. ": " .. err | 212 | return nil, "Could not remove " .. file .. ": " .. err, "not found" |
| 213 | end | 213 | end |
| 214 | 214 | ||
| 215 | fs.delete(suffixed_file) | 215 | fs.delete(suffixed_file) |
| 216 | if fs.exists(suffixed_file) then | 216 | if fs.exists(suffixed_file) then |
| 217 | return nil, "Failed deleting " .. suffixed_file .. ": file still exists" | 217 | return nil, "Failed deleting " .. suffixed_file .. ": file still exists", "fail" |
| 218 | end | 218 | end |
| 219 | 219 | ||
| 220 | return true | 220 | return true |
| @@ -375,8 +375,14 @@ function repos.delete_version(name, version, deps_mode, quick) | |||
| 375 | target = versioned | 375 | target = versioned |
| 376 | end | 376 | end |
| 377 | 377 | ||
| 378 | local ok, err = delete_suffixed(target, suffix) | 378 | local ok, err, err_type = delete_suffixed(target, suffix) |
| 379 | if not ok then return nil, err end | 379 | if not ok then |
| 380 | if err_type == "not found" then | ||
| 381 | util.warning(err) | ||
| 382 | else | ||
| 383 | return nil, err | ||
| 384 | end | ||
| 385 | end | ||
| 380 | 386 | ||
| 381 | if not quick and target == non_versioned then | 387 | if not quick and target == non_versioned then |
| 382 | -- If another package provides this file, move its version | 388 | -- If another package provides this file, move its version |
