From ad0458f5826a9283df3e152fea24869d0914634d Mon Sep 17 00:00:00 2001 From: Pablo Alessandro Santos Hugen Date: Thu, 29 Jan 2026 19:24:39 -0300 Subject: [PATCH] std.Build: Fix wrong error enum Signed-off-by: Pablo Alessandro Santos Hugen --- lib/std/Build/Step/Run.zig | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/std/Build/Step/Run.zig b/lib/std/Build/Step/Run.zig index d822697ae56fa6ac6ab29fa083a8ca9aa53de652..d025e01af40f8d3580e37ad830ee7515f0608cb4 100644 --- a/lib/std/Build/Step/Run.zig +++ b/lib/std/Build/Step/Run.zig @@ -1033,8 +1033,8 @@ fn make(step: *Step, options: Step.MakeOptions) !void { if (any_output) { const o_sub_path = "o" ++ Dir.path.sep_str ++ &digest; - b.cache_root.handle.rename(tmp_dir_path, b.cache_root.handle, o_sub_path, io) catch |err| { - if (err == error.PathAlreadyExists) { + b.cache_root.handle.rename(tmp_dir_path, b.cache_root.handle, o_sub_path, io) catch |err| switch (err) { + Dir.RenameError.DirNotEmpty => { b.cache_root.handle.deleteTree(io, o_sub_path) catch |del_err| { return step.fail("unable to remove dir '{f}'{s}: {t}", .{ b.cache_root, tmp_dir_path, del_err, @@ -1045,11 +1045,10 @@ fn make(step: *Step, options: Step.MakeOptions) !void { b.cache_root, tmp_dir_path, b.cache_root, o_sub_path, retry_err, }); }; - } else { - return step.fail("unable to rename dir '{f}{s}' to '{f}{s}': {t}", .{ - b.cache_root, tmp_dir_path, b.cache_root, o_sub_path, err, - }); - } + }, + else => return step.fail("unable to rename dir '{f}{s}' to '{f}{s}': {t}", .{ + b.cache_root, tmp_dir_path, b.cache_root, o_sub_path, err, + }), }; } -- 2.54.0