diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2017-12-19 12:25:44 -0200 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2017-12-19 12:25:44 -0200 |
| commit | eb89bafa29cf63600154d162429c803bb782c428 (patch) | |
| tree | 29b91e7f278e02593f08f158995d0aa13099430e /src | |
| parent | cef3203f735103a2e0e1ddefdf8686c94c712ec9 (diff) | |
| download | luarocks-eb89bafa29cf63600154d162429c803bb782c428.tar.gz luarocks-eb89bafa29cf63600154d162429c803bb782c428.tar.bz2 luarocks-eb89bafa29cf63600154d162429c803bb782c428.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 c20d3589..12927153 100644 --- a/src/luarocks/repos.lua +++ b/src/luarocks/repos.lua | |||
| @@ -214,12 +214,12 @@ end | |||
| 214 | local function delete_suffixed(file, suffix) | 214 | local function delete_suffixed(file, suffix) |
| 215 | local suffixed_file, err = find_suffixed(file, suffix) | 215 | local suffixed_file, err = find_suffixed(file, suffix) |
| 216 | if not suffixed_file then | 216 | if not suffixed_file then |
| 217 | return nil, "Could not remove " .. file .. ": " .. err | 217 | return nil, "Could not remove " .. file .. ": " .. err, "not found" |
| 218 | end | 218 | end |
| 219 | 219 | ||
| 220 | fs.delete(suffixed_file) | 220 | fs.delete(suffixed_file) |
| 221 | if fs.exists(suffixed_file) then | 221 | if fs.exists(suffixed_file) then |
| 222 | return nil, "Failed deleting " .. suffixed_file .. ": file still exists" | 222 | return nil, "Failed deleting " .. suffixed_file .. ": file still exists", "fail" |
| 223 | end | 223 | end |
| 224 | 224 | ||
| 225 | return true | 225 | return true |
| @@ -378,8 +378,14 @@ function repos.delete_version(name, version, deps_mode, quick) | |||
| 378 | target = versioned | 378 | target = versioned |
| 379 | end | 379 | end |
| 380 | 380 | ||
| 381 | local ok, err = delete_suffixed(target, suffix) | 381 | local ok, err, err_type = delete_suffixed(target, suffix) |
| 382 | if not ok then return nil, err end | 382 | if not ok then |
| 383 | if err_type == "not found" then | ||
| 384 | util.warning(err) | ||
| 385 | else | ||
| 386 | return nil, err | ||
| 387 | end | ||
| 388 | end | ||
| 383 | 389 | ||
| 384 | if not quick and target == non_versioned then | 390 | if not quick and target == non_versioned then |
| 385 | -- If another package provides this file, move its version | 391 | -- If another package provides this file, move its version |
