hauleth/erlang-systemd

How to clear service status / send empty values?

dumbbell opened this issue · 1 comments

This is more a question than an issue at this stage.

Here, when a line is encoded before it is sent to systemd, variables with no data are dropped:

encode_field(Name, Data) ->
case string:is_empty(Data) of
true -> [];
false ->
Sep = case string:find(Data, "\n") of

The only way I found so far to clear the status of a service (using systemd:notify({status, Status})) is to set it to an empty string. Unfortunately, out-of-the-box, the value is dropped during encode. If I comment this string:is_empty() out, the status is correctly cleared according to "systemctl status $service".

Is it invalid to send empty values to systemd?

I do not remember why I have done that. Send PR that removes this check and we will be ok.