notify: don't send EXIT_STATUS= notify message from systemd-notify

In 623a00020f code was added that our
various programs send a notification message with their exit status on
exit. This is great, but it becomes utterly confusing in systemd-notify,
whose primary purpose is to send such messages after all, and sending an
implicit one in addition to the primary one is particularly confusing,
when debugging things.

Let's hence just drop the implicit message. systemd-notify's exit status
is after all indicative primarily because sd_notify() failed, and hence
it's pretty pointless to then send that fact as another sd_notify()
message.

(Primary reason for this patch is simply that it confused the hell out
of me, when debugging sd_notify() issues)

Follow-up for: 623a00020f
This commit is contained in:
Lennart Poettering 2023-05-03 14:14:06 +02:00
parent c4039ceb9e
commit 09e766e70b

View file

@ -467,6 +467,11 @@ static int run(int argc, char* argv[]) {
return log_error_errno(errno, "Failed to execute command line: %s", cmdline);
}
/* The DEFINE_MAIN_FUNCTION_WITH_POSITIVE_FAILURE() boilerplate will send the exit status via
* sd_notify(). Which is normally fine, but very confusing in systemd-notify, whose purpose is to
* send user-controllable notification messages, and not implicit ones. Let's turn if off, by
* unsetting the $NOTIFY_SOCKET environment variable. */
(void) unsetenv("NOTIFY_SOCKET");
return 0;
}