Closed jokeyrhyme closed 8 months ago
Another thought I had is that we could detect systemd the same way cosmic-comp
does (using the libsystemd crate), and then change the behaviour of this PR (or in a follow-up PR) to not even attempt to call systemctl
if systemd is not running
That would keep logs cleaner on non-systemd systems
Another thought I had is that we could detect systemd the same way
cosmic-comp
does (using the libsystemd crate), and then change the behaviour of this PR (or in a follow-up PR) to not even attempt to callsystemctl
if systemd is not runningThat would keep logs cleaner on non-systemd systems
It might, but we would pull another dbus api, which we don't really need. It think this is fine.
std::process::Command
work, and made that function swallow errors rather than return them or panic (because we want to keep systemd optional)std::process::Command
, because it's allegedly faster to skip inheriting the parent's stdin (and it's not our intention to allow this inheritance anyway).spawn()
to.status()
so that we can at least find out ifsystemctl
accepted our calls (mostly for diagnostic purposes)--no-block
tosystemctl
when starting/stopping the graphical target, because we care mostly that we called into systemd successfully, not what happens inside systemd after thatin all testing below, the session and compositor continue to launch as normal:
systemctl --user status cosmic-session.target
shows it is activesystemctl-foo
as the hardcoded command, to confirm that that theErr
branch results in the expected logs, and thatsystemctl --user status cosmic-session.target
shows it is inactivecosmic-session-foo.target
as the hardcoded target, to confirm that that the non-zero exit status code branch results in the expected logs, and thatsystemctl --user status cosmic-session.target
shows it is inactive