busctl: send READY=1 when we become a monitor

This is pretty much the same stuff as `resolvectl monitor` does, and
allows us to run `busctl monitor` in a Type=notify unit which ensures
that `busctl` is really listening for messages once the unit is marked
as started.
This commit is contained in:
Frantisek Sumsal 2023-11-08 23:57:27 +01:00
parent 9a42457bae
commit c39a6ab789

View File

@ -1311,6 +1311,8 @@ static int monitor(int argc, char **argv, int (*dump)(sd_bus_message *m, FILE *f
if (!arg_quiet && arg_json_format_flags == JSON_FORMAT_OFF)
log_info("Monitoring bus message stream.");
(void) sd_notify(/* unset_environment=false */ false, "READY=1");
for (;;) {
_cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL;