From 2af0fbca5e21d6ffa9663ff96b8a8f5d13c262d2 Mon Sep 17 00:00:00 2001 Message-Id: <2af0fbca5e21d6ffa9663ff96b8a8f5d13c262d2.1714113070.git.mdw@distorted.org.uk> From: Mark Wooding Date: Sat, 21 Jul 2018 15:26:21 +0100 Subject: [PATCH] clients/disorder.c: Force line buffering when writing log. Organization: Straylight/Edgeware From: Mark Wooding 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. --- clients/disorder.c | 1 + 1 file changed, 1 insertion(+) 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); } -- [mdw]