Skip printing messages after count in aos_dump
There are cases where the event loop will attempt to flush pending
callbacks after Exit. It can do this for quite a while. That causes
messages to be printed after Exit.
Skip printing if we get called after we meet our count to prevent that.
Change-Id: I3a8da059b29953c71f8f3fade7415c4c19cafaf7
diff --git a/aos/aos_dump.cc b/aos/aos_dump.cc
index 78df645..45168b2 100644
--- a/aos/aos_dump.cc
+++ b/aos/aos_dump.cc
@@ -95,6 +95,9 @@
[channel, &str_builder, &cli_info, &message_count, &next_send_time](
const aos::Context &context, const void * /*message*/) {
if (context.monotonic_event_time > next_send_time) {
+ if (FLAGS_count > 0 && message_count >= FLAGS_count) {
+ return;
+ }
PrintMessage(channel, context, &str_builder);
++message_count;
next_send_time = context.monotonic_event_time +