From c3da8c067f7e814a76633e4b2a978d6d08c0797a Mon Sep 17 00:00:00 2001 From: Emil Lerch Date: Tue, 15 Aug 2023 07:26:14 -0700 Subject: [PATCH] only close if opened --- codegen/src/main.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codegen/src/main.zig b/codegen/src/main.zig index 210c5db..255b4cf 100644 --- a/codegen/src/main.zig +++ b/codegen/src/main.zig @@ -15,7 +15,7 @@ pub fn main() anyerror!void { const stdout = std.io.getStdOut().writer(); var output_dir = std.fs.cwd(); - defer output_dir.close(); + defer if (output_dir.fd > 0) output_dir.close(); var models_dir: ?std.fs.IterableDir = null; defer if (models_dir) |*m| m.close(); for (args, 0..) |arg, i| {