notify: Add EXIT_STATUS field

Whenever one of our tools or daemons exits, let's send the exit status
via sd-notify in the EXIT_STATUS field.
This commit is contained in:
Daan De Meyer 2023-04-12 11:56:00 +02:00
parent 3af48a86d9
commit 623a00020f
2 changed files with 8 additions and 0 deletions

View file

@ -170,6 +170,13 @@
<literal>BUSERROR=org.freedesktop.DBus.Error.TimedOut</literal></para></listitem>
</varlistentry>
<varlistentry>
<term>EXIT_STATUS=…</term>
<listitem><para>If a service exits, the return value of its <function>main()</function> function.
</para></listitem>
</varlistentry>
<varlistentry>
<term>MAINPID=…</term>

View file

@ -21,6 +21,7 @@
r = impl; \
if (r < 0) \
(void) sd_notifyf(0, "ERRNO=%i", -r); \
(void) sd_notifyf(0, "EXIT_STATUS=%i", ret); \
ask_password_agent_close(); \
polkit_agent_close(); \
pager_close(); \