From 2f9b125c1c6d617a34b8b9e726e1eea56d200cc1 Mon Sep 17 00:00:00 2001 From: ZYP Date: Sat, 12 Sep 2026 23:49:24 +0800 Subject: [PATCH] Flush Done lines when stdout is a pipe setvbuf(stdout, NULL, _IOLBF, 0) so interactive completion messages like "Done -> ..." reach piped clients immediately (antirez/h3.c#25). --- main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.c b/main.c index 7f11e470..e5b1de52 100644 --- a/main.c +++ b/main.c @@ -229,6 +229,10 @@ static int cli_frame(const h3_frame *frame, void *opaque) { } int main(int argc, char **argv) { + /* Line-buffer stdout so Done/status lines flush immediately when + * stdout is a pipe (non-TTY). See antirez/h3.c#25. */ + setvbuf(stdout, NULL, _IOLBF, 0); + enum { OPT_WIDTH = 1000, OPT_HEIGHT, OPT_RENDER_WIDTH, OPT_RENDER_HEIGHT, OPT_FRAMES, OPT_SECONDS, OPT_STEPS, OPT_REUSE, OPT_LAYERS,