busctl: handle --limit-messages option under the wait verb

Main focus was to not introduce breaking change or duplicated argument.
The `--limit-messages=` option that is used under the `monitor` verb is
reused here. However, both `wait` and `monitor` have contradicting
default behaviors, so it's not the cleanest thing to do.

There was some post-commit discussion about the API in #33961, but the
final name adopted in #34928 wasn't that flexible either to fit nicely
here in the `wait` verbe.

Additionally, there wasn't consideration in #34555 for having uniform
behavrious, so we ended with `wait` verb and `--limit-messages=` option,
rather than `receive` verb with default of continuously receving signals
withtout exit so `--limit-messages=` make more sence and be expectable.
This commit is contained in:
zefr0x
2026-01-19 22:41:33 +09:00
committed by Yu Watanabe
parent 30f3a7ad51
commit 985a6fa44b
3 changed files with 60 additions and 10 deletions
+13 -5
View File
@@ -75,7 +75,7 @@
to or from this peer, identified by its well-known or unique
name. Otherwise, show all messages on the bus. Use
<keycombo><keycap>Ctrl</keycap><keycap>C</keycap></keycombo>
to terminate the dump.</para>
to terminate the dump or limit it with the <option>--limit-messages=</option> option.</para>
<xi:include href="version-info.xml" xpointer="v209"/></listitem>
</varlistentry>
@@ -147,9 +147,10 @@
<varlistentry>
<term><command>wait</command> <arg choice="opt"><replaceable>SERVICE</replaceable></arg> <arg choice="plain"><replaceable>OBJECT</replaceable></arg> <arg choice="plain"><replaceable>INTERFACE</replaceable></arg> <arg choice="plain"><replaceable>SIGNAL</replaceable></arg></term>
<listitem><para>Wait for a signal. Takes an object path, interface name, and signal name. To suppress
output of the returned data, use the <option>--quiet</option> option. The service name may be
omitted, in which case <command>busctl</command> will match signals from any sender.</para>
<listitem><para>Wait for a signal. Takes an object path, interface name, and signal name. Use the
<option>--limit-messages=</option> option to wait for more than just one signal before exiting. To
suppress output of the returned data, use the <option>--quiet</option> option. The service name may
be omitted, in which case <command>busctl</command> will match signals from any sender.</para>
<xi:include href="version-info.xml" xpointer="v257"/></listitem>
</varlistentry>
@@ -398,7 +399,14 @@
<para>When used with the <command>monitor</command> command, if enabled will make
<command>busctl</command> exit when the specified number of messages have been received and
printed. This is useful in combination with <option>--match=</option>, to wait for the specified
number of occurrences of specific D-Bus messages.</para>
number of occurrences of specific D-Bus messages. While if not specified or is set to special value
<literal>infinity</literal>, the default is to keep monitoring without limitations.</para>
<para>When used with the <command>wait</command> command, it will make <command>busctl</command>
exit when the specified number of DBus signals have been received and printed. Setting it to
special value <literal>infinity</literal> will sustain <command>busctl</command> to receive and
print signals continuously without limitations. When nothing is specified, the default is to exit
immediately after receiving and printing the first signal.</para>
<xi:include href="version-info.xml" xpointer="v257"/>
</listitem>