mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 19:36:18 +01:00
gmessages: Flush output stream after logging messages
When debug output is enabled then certain messages will be logged to stdout. stdout however is block buffered by default when it isn't going to a TTY meaning that debug logging will not be flushed out properly when it is being redirected. One example of this happening may be tests that rely on parsing g_debug messages. Adding an explicit fflush ensures all log messages will reach the output. https://bugzilla.gnome.org/show_bug.cgi?id=792432
This commit is contained in:
parent
051d69bbc8
commit
5fba62adec
@ -2556,6 +2556,7 @@ g_log_writer_standard_streams (GLogLevelFlags log_level,
|
||||
out = g_log_writer_format_fields (log_level, fields, n_fields,
|
||||
g_log_writer_supports_color (fileno (stream)));
|
||||
_g_fprintf (stream, "%s\n", out);
|
||||
fflush (stream);
|
||||
g_free (out);
|
||||
|
||||
return G_LOG_WRITER_HANDLED;
|
||||
|
Loading…
Reference in New Issue
Block a user