diff --git a/client/client_msgs.cpp b/client/client_msgs.cpp index 356fdddcdb..8c158a90d0 100644 --- a/client/client_msgs.cpp +++ b/client/client_msgs.cpp @@ -125,6 +125,11 @@ void show_message( // print message to the console printf("%s", evt_message); +#ifdef _MSC_VER + // MSVCRT doesn't support line buffered streams + fflush(stdout); +#endif + // print message to the debugger view port diagnostics_trace_to_debugger(evt_message); } diff --git a/client/main.cpp b/client/main.cpp index e4fd1e87e2..0c76d6e8fc 100644 --- a/client/main.cpp +++ b/client/main.cpp @@ -83,6 +83,10 @@ void log_message_startup(const char* msg) { ); if (!gstate.executing_as_daemon) { fprintf(stdout, "%s", evt_msg); +#ifdef _MSC_VER + // MSVCRT doesn't support line buffered streams + fflush(stdout); +#endif } else { #ifdef _WIN32 LogEventInfoMessage(evt_msg); @@ -373,8 +377,6 @@ int boinc_main_loop() { if (!gstate.poll_slow_events()) { gstate.do_io_or_sleep(POLL_INTERVAL); } - fflush(stderr); - fflush(stdout); if (gstate.time_to_exit()) { msg_printf(NULL, MSG_INFO, "Time to exit"); diff --git a/lib/diagnostics.cpp b/lib/diagnostics.cpp index bdd1707497..ec3704abce 100644 --- a/lib/diagnostics.cpp +++ b/lib/diagnostics.cpp @@ -352,6 +352,7 @@ int diagnostics_init( if (!stdout_file) { return ERR_FOPEN; } + setvbuf(stdout_file, NULL, _IOLBF, BUFSIZ); } if (flags & BOINC_DIAG_REDIRECTSTDOUTOVERWRITE) { @@ -359,6 +360,7 @@ int diagnostics_init( if (!stdout_file) { return ERR_FOPEN; } + setvbuf(stdout_file, NULL, _IOLBF, BUFSIZ); }