From ce3fe72d9a5e380ad3e25018e562abebc5ee24a6 Mon Sep 17 00:00:00 2001 From: xEgoist Date: Sat, 22 Apr 2023 06:26:42 -0500 Subject: [PATCH] fs.Dir.deleteTree: Fix DirNotEmpty condition `deleteTree` needs to retry once the directory is reported to be not empty. Otherwise, the retry condition is never reached. --- lib/std/fs.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/std/fs.zig b/lib/std/fs.zig index b5e2d7ad6373..61d7b9facad9 100644 --- a/lib/std/fs.zig +++ b/lib/std/fs.zig @@ -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, };