tools: fflush the output in debug-events after each set of events
authorPeter Hutterer <peter.hutterer@who-t.net>
Thu, 12 Jan 2023 23:23:52 +0000 (09:23 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Thu, 12 Jan 2023 23:28:32 +0000 (09:28 +1000)
Fixes e.g. the case where debug-events is used to get the initial device
list but no more. Since we never flush, the content is stuck in the
buffers and gets lost.

Easy way to reproduce: `libinput debug-events | cat`, then ctrl+c and see
nothing show up (before this patch, anyway).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
tools/libinput-debug-events.c

index 9ad71b6a56af5498864e459c8f5a731a5122ccd1..9034e2cdb7b06a8bad06f99de5260340c939eabf 100644 (file)
@@ -951,6 +951,9 @@ handle_and_print_events(struct libinput *li)
                libinput_event_destroy(ev);
                rc = 0;
        }
+
+       fflush(stdout);
+
        return rc;
 }