Skip to content

Commit d278dc4

Browse files
authored
fix: propagate errors in recursive_delete and recursive_copy (#712)
The `complete` callback checks `err` instead of `err2`, but `err` is always nil inside the `elseif entries` branch. This silently ignores child operation errors, causing misleading "directory not empty" failures.
1 parent 43227c5 commit d278dc4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lua/oil/fs.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ M.recursive_delete = function(entry_type, path, cb)
218218
local waiting = #entries
219219
local complete
220220
complete = function(err2)
221-
if err then
221+
if err2 then
222222
complete = function() end
223223
return inner_cb(err2)
224224
end
@@ -320,7 +320,7 @@ M.recursive_copy = function(entry_type, src_path, dest_path, cb)
320320
local waiting = #entries
321321
local complete
322322
complete = function(err2)
323-
if err then
323+
if err2 then
324324
complete = function() end
325325
return inner_cb(err2)
326326
end

0 commit comments

Comments
 (0)