fix: use flush instead of end on stdout in code generators for Windows compatibility

This commit is contained in:
Tommy D. Rossi
2026-01-03 03:57:44 +01:00
parent 1c2db85aa4
commit 4ea669562e
2 changed files with 6 additions and 2 deletions

View File

@@ -87,7 +87,9 @@ pub fn main() !void {
var buf: [4096]u8 = undefined;
var stdout = std.fs.File.stdout().writer(&buf);
try t.writeZig(&stdout.interface);
try stdout.end();
// Use flush instead of end because stdout is a pipe when captured by
// the build system, and pipes cannot be truncated (especially on Windows).
try stdout.interface.flush();
// Uncomment when manually debugging to see our table sizes.
// std.log.warn("stage1={} stage2={} stage3={}", .{

View File

@@ -34,7 +34,9 @@ pub fn main() !void {
var buf: [4096]u8 = undefined;
var stdout = std.fs.File.stdout().writer(&buf);
try t.writeZig(&stdout.interface);
try stdout.end();
// Use flush instead of end because stdout is a pipe when captured by
// the build system, and pipes cannot be truncated (especially on Windows).
try stdout.interface.flush();
// Uncomment when manually debugging to see our table sizes.
// std.log.warn("stage1={} stage2={} stage3={}", .{