The var stdout_writer: std.Io.Writer = stdout.writer(stdout_writer_buf).interface; line is incorrect - it copies the std.Io.Writer interface out of the parent struct, and since the interface uses @fieldParentPointer to find the parent struct, it’ll probably fail to flush in the best case. See Zig 0.15.1 reader/writer: Don't make copies of @fieldParentPtr()-based interfaces for reference.
4 Likes