From: Gerhard Sittig Date: Mon, 29 Jan 2018 19:10:36 +0000 (+0100) Subject: log: flush log lines, to cope with non-terminal output (pipes) X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=241c03029d3787497babc6a88d67261b41410044;p=libsigrok.git log: flush log lines, to cope with non-terminal output (pipes) Although log messages are terminated by a line feed, output still might get buffered when the program does not talk to a terminal (that it is aware of). Add an fflush(3) call to the printf(3) sequence such that log output will immediately show up when writing to pipes or sockets, too. --- diff --git a/src/log.c b/src/log.c index cdf2293b..55c5270f 100644 --- a/src/log.c +++ b/src/log.c @@ -204,6 +204,7 @@ static int sr_logv(void *cb_data, int loglevel, const char *format, va_list args } g_fprintf(stderr, "%s\n", output); + fflush(stderr); g_free(raw_output); g_free(output);