Odd flushing behavior
mcandre opened this issue · 2 comments
I'm used to fprintf()
intelligently flushing my output streams, e.g. when writing brief text blurbs to stderr in a Read Eval Print Loop application. However, CloudABI appears to wait until the program is terminating to flush. Could we get the flushing behavior closer to a typical GNU/libc fprintf()
implicit flush?
As a workaround, I am doing this for important user feedback sections:
fprintf(console, "blahblahblah\n");
#if defined(__CloudABI__)
fflush(console);
#endif
Hey! That's because on CloudABI, pipes and TTYs are treated identically. If you want line buffering, just call setvbuf()
after opening the stream.
@EdSchouten Oh, thank you for clarifying!
Would it make sense for the yaml config to offer a tty
bool option on fd's? Perhaps this could automatically be enabled for the stdout, stderr streams.