From 298328581534de4b7cb984f7d5e8a5c4080a881c Mon Sep 17 00:00:00 2001 From: Techatrix Date: Sat, 9 Aug 2025 13:47:07 +0200 Subject: [PATCH] zig fmt: flush stdout before exiting with error --- src/fmt.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fmt.zig b/src/fmt.zig index 92ae22e4bc..aa23d48302 100644 --- a/src/fmt.zig +++ b/src/fmt.zig @@ -195,10 +195,10 @@ pub fn run(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { for (input_files.items) |file_path| { try fmtPath(&fmt, file_path, check_flag, fs.cwd(), file_path); } + try fmt.stdout_writer.interface.flush(); if (fmt.any_error) { process.exit(1); } - try fmt.stdout_writer.interface.flush(); } fn fmtPath(fmt: *Fmt, file_path: []const u8, check_mode: bool, dir: fs.Dir, sub_path: []const u8) !void {