Fix compile-time errors with --no-default-features

This commit is contained in:
Foxinatel 2024-08-09 17:53:06 +01:00 • committed by Victoria Brekenfeld
parent 4df7261a6c
commit 7b1588611c

View file

@ -21,6 +21,7 @@ use cosmic_notifications_util::{DAEMON_NOTIFICATIONS_FD, PANEL_NOTIFICATIONS_FD}
use futures_util::StreamExt; use futures_util::StreamExt;
use launch_pad::{process::Process, ProcessManager}; use launch_pad::{process::Process, ProcessManager};
use service::SessionRequest; use service::SessionRequest;
#[cfg(feature = "systemd")]
use systemd::{is_systemd_used, spawn_scope}; use systemd::{is_systemd_used, spawn_scope};
use tokio::{ use tokio::{
net::UnixStream, net::UnixStream,
@ -58,10 +59,9 @@ async fn main() -> Result<()> {
let session_tx_clone = session_tx.clone(); let session_tx_clone = session_tx.clone();
let _conn = ConnectionBuilder::session()? let _conn = ConnectionBuilder::session()?
.name("com.system76.CosmicSession")? .name("com.system76.CosmicSession")?
.serve_at( .serve_at("/com/system76/CosmicSession", service::SessionService {
"/com/system76/CosmicSession", session_tx,
service::SessionService { session_tx }, })?
)?
.build() .build()
.await?; .await?;
@ -135,8 +135,8 @@ async fn start(
.await .await
.expect("failed to start settings daemon"); .expect("failed to start settings daemon");
// notifying the user service manager that we've reached the graphical-session.target, // notifying the user service manager that we've reached the
// which should only happen after: // graphical-session.target, which should only happen after:
// - cosmic-comp is ready // - cosmic-comp is ready
// - we've set any related variables // - we've set any related variables
// - cosmic-settings-daemon is ready // - cosmic-settings-daemon is ready
@ -379,22 +379,17 @@ async fn start_component(
} }
.instrument(stderr_span) .instrument(stderr_span)
}) })
.with_on_start(move |pman, pkey, _will_restart| { .with_on_start(move |pman, pkey, _will_restart| async move {
#[cfg(feature = "systemd")] #[cfg(feature = "systemd")]
{ if *is_systemd_used() {
async move { if let Ok((innr_cmd, Some(pid))) = pman.get_exe_and_pid(pkey).await {
if *is_systemd_used() { if let Err(err) = spawn_scope(innr_cmd.clone(), vec![pid]).await {
if let Ok((innr_cmd, Some(pid))) = pman.get_exe_and_pid(pkey).await warn!(
{ "Failed to spawn scope for {}. Creating transient unit failed \
if let Err(err) = spawn_scope(innr_cmd.clone(), vec![pid]).await with {}",
{ innr_cmd, err
warn!( );
"Failed to spawn scope for {}. Creating transient unit failed with {}", };
innr_cmd, err
);
};
}
}
} }
} }
}) })