Skip to content

Commit

Permalink
fs.Dir.deleteTree: Fix DirNotEmpty condition
Browse files Browse the repository at this point in the history
`deleteTree` needs to retry once the directory is reported to be not
empty. Otherwise, the retry condition is never reached.
  • Loading branch information
xEgoist authored and Vexu committed Apr 23, 2023
1 parent 23c4f55 commit ce3fe72
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/std/fs.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2210,7 +2210,7 @@ pub const Dir = struct {
var need_to_retry: bool = false;
parent_dir.deleteDir(name) catch |err| switch (err) {
error.FileNotFound => {},
error.DirNotEmpty => need_to_retry = false,
error.DirNotEmpty => need_to_retry = true,
else => |e| return e,
};

Expand Down

0 comments on commit ce3fe72

Please sign in to comment.