0.16
I’m missing something pretty basic here, but that’s probably all the more reason to document.
I wrote a function that takes a writer. I think it works fine for its normal intended use, but for some quick tracing, I wanted to just send it a writer I constructed from stdout. (Obviously, it’s more normal to just std.debug.print() to debug-print, but, again, I have an interface I’d like to take advantage of.) Handily, std.Io.File.stdout() exists. I’d never tried it before. So I just tried this proof-of-concept:
const io = std.testing.io;
const f = std.Io.File.stdout();
defer f.close();
var buf: [512]u8 = undefined;
var w = f.writer(io, &buf);
_ = try w.interface.write("hello there!\n");
And got nuthin’. I tried flush(), though a comment in the STD API (I think for stdout()) indicated that flush() was NOT needed in this case. But flush() just caused a forever hang. I could have dug deeper, but I think I know what’s going on there, and didn’t pursue. This is “simple enough”-looking that I thought I probably shouldn’t have to dig very deep (perhaps that’s my mistake)… so… what am I missing?