Connect to systemd over session DBus rather than system (#2)

This seems to be correct for starting user services.
This commit is contained in:
Ian Douglas Scott 2022-07-20 08:05:19 -07:00 committed by GitHub
parent cefd13692b
commit c450a9ed0d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 1 deletions

View file

@ -1,9 +1,11 @@
// SPDX-License-Identifier: GPL-3.0-only
use color_eyre::{eyre::WrapErr, Result};
use systemd_client::manager::SystemdManagerProxy;
pub async fn start_systemd_target() -> Result<()> {
let manager = systemd_client::manager::build_nonblock_proxy()
let connection = zbus::Connection::session().await?;
let manager = SystemdManagerProxy::new(&connection)
.await
.wrap_err("failed to connect to org.freedesktop.systemd1.Manager")?;
manager