Skip to content

Commit fa52f7a

Browse files
committed
Disable std{out,err} buffering
Disable buffering for stdout and stderr to avoid issues when output is redirected to a file or pipe instead of being displayed in a terminal.
1 parent 736dd70 commit fa52f7a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/main.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,12 @@ int main(int argc, char **argv)
274274
}
275275
#endif // _WIN32
276276

277+
// Disable buffering for stdout and stderr to avoid issues when output
278+
// is redirected to a file or pipe instead of being displayed in a
279+
// terminal.
280+
setbuf(stdout, NULL);
281+
setbuf(stderr, NULL);
282+
277283
memset(&g_cluster, 0, sizeof(g_cluster));
278284

279285
g_cluster.tcpsocket = INVALID_SOCKET;

0 commit comments

Comments
 (0)