]> code.delx.au - pulseaudio/commitdiff
pactl: Flush stdout buffer when printing subscribe events.
authorNikolay Amiantov <nikoamia@gmail.com>
Sun, 5 May 2013 11:22:53 +0000 (15:22 +0400)
committerArun Raghavan <arun.raghavan@collabora.co.uk>
Mon, 3 Jun 2013 19:08:41 +0000 (00:38 +0530)
"pactl subscribe" is running continuously, and without flushing its output is
not usable for "process-on-arrival" per-line tasks, such as grepping. This
patch should fix this. For example, now:
pactl subscribe | grep 'server'
should print only server events as they arrive.

src/utils/pactl.c

index 0fb62cb064eae0b58d34a8d5398420d3fe7af715..3b6770f05ec326cf22337ba337f682a245c5ff54 100644 (file)
@@ -1169,6 +1169,7 @@ static void context_subscribe_callback(pa_context *c, pa_subscription_event_type
            subscription_event_type_to_string(t),
            subscription_event_facility_to_string(t),
            idx);
+    fflush(stdout);
 }
 
 static void context_state_callback(pa_context *c, void *userdata) {