Skip to content

Commit e42b8f6

Browse files
committed
Interleave of stdout and stderr
During testing of #10129 we saw that there were some warnings that should have been at the end of log but appeared in the middle of the (last) lock of `Patching ...`. This is due to the fact that `stdout` and `stderr` are less good synchronized for non terminal modes. We should flush the `stdout` before writing the block of warnings
1 parent 495b3c2 commit e42b8f6

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/message.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ void msg(const char *fmt, ...)
111111
}
112112
}
113113

114+
void msg_flush()
115+
{
116+
fflush(stdout);
117+
}
118+
119+
114120
static void format_warn(const QCString &file,int line,const QCString &text)
115121
{
116122
QCString fileSubst = file.isEmpty() ? "<unknown>" : file;
@@ -304,6 +310,7 @@ void warn_flush()
304310

305311
extern void finishWarnExit()
306312
{
313+
msg_flush();
307314
if (g_warnBehavior == WARN_AS_ERROR_t::FAIL_ON_WARNINGS_PRINT && g_warnlogFile != "-")
308315
{
309316
Portable::fclose(g_warnFile);

src/message.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ extern void term(const char *fmt, ...) PRINTFLIKE(1, 2);
3939
extern QCString warn_line(const QCString &file,int line);
4040
void initWarningFormat();
4141
void warn_flush();
42+
void msg_flush();
4243
extern void finishWarnExit();
4344

4445
#undef PRINTFLIKE

0 commit comments

Comments
 (0)