lucab / libsystemd-rs

A pure-Rust client library to work with systemd
https://crates.io/crates/libsystemd
Other
106 stars 19 forks source link

Add support for sending file descriptors #115

Closed janderholm closed 1 year ago

janderholm commented 1 year ago

This is required for proper use of FDSTORE.

There's also a small example which uses FDSTORE to maintain some state which are persistent over restarts of various kinds.

swsnr commented 1 year ago

@janderholm Would you mind to rebase onto master to bring in fixes to the pipeline to make the checks pass here?

janderholm commented 1 year ago

Yes! I will continue looking into it over the weekend.

janderholm commented 1 year ago

Oh no! I accidentally pushed the wrong branch and this closed the pull request!

janderholm commented 1 year ago

I believe I have addressed your comments and think I managed to restore the pull request.

janderholm commented 1 year ago

I managed to cobble something together. It works similarly to the connected_to_journal test except that it simply includes examples/persistent_state.rs, run that and check the exit code.

It seems to work, but I'm a bit unsure of the arguments to systemd-run. For example I don't understand --collect.

I had to change the example doc comment to a regular comment because it was not possible to include!(...) it otherwise. But since it's an example it doesn't normally show up in the docs anyway.

lucab commented 1 year ago

For example I don't understand --collect.

systemd-run does create an ephemeral unit/scope to actually run the binary. The --collect option is meant to clean up all such transient content (i.e. perform "garbage collection") upon exit.