From: Mark Wooding Date: Sat, 21 Jul 2018 14:26:21 +0000 (+0100) Subject: clients/disorder.c: Force line buffering when writing log. X-Git-Tag: 5.2~12 X-Git-Url: https://git.distorted.org.uk/~mdw/disorder/commitdiff_plain/2af0fbca5e21d6ffa9663ff96b8a8f5d13c262d2 clients/disorder.c: Force line buffering when writing log. Otherwise it looks fine on a terminal, but that's not very useful. If a program tries to read the log over a pipe, then it sees nothing for a good long while until the buffer gets flushed. This change is specific to the `log' command. Output for other commands comes out at the same time anyway. --- diff --git a/clients/disorder.c b/clients/disorder.c index dc86a65..b9b2bb2 100644 --- a/clients/disorder.c +++ b/clients/disorder.c @@ -348,6 +348,7 @@ static void cf_set_volume(char **argv) { } static void cf_log(char attribute((unused)) **argv) { + setvbuf(stdout, 0, _IOLBF, BUFSIZ); if(disorder_log(getclient(), sink_stdio("stdout", stdout))) exit(EXIT_FAILURE); }