Private
Public Access
1
0

kordophoned sans kpcli building on macos

This commit is contained in:
James Magahern
2025-07-31 19:16:44 -07:00
parent 742703cb8e
commit 8115f94121
11 changed files with 120 additions and 27 deletions

View File

@@ -1,4 +1,6 @@
mod daemon;
#[cfg(target_os = "linux")]
mod dbus;
use log::LevelFilter;
@@ -6,8 +8,6 @@ use std::future;
use daemon::Daemon;
use dbus::agent::DBusAgent;
fn initialize_logging() {
// Weird: is this the best way to do this?
let log_level = std::env::var("RUST_LOG")
@@ -20,6 +20,27 @@ fn initialize_logging() {
.init();
}
#[cfg(target_os = "linux")]
async fn start_ipc_agent(daemon: &Daemon) {
use dbus::agent::DBusAgent;
// Start the D-Bus agent (events in, signals out).
let agent = DBusAgent::new(daemon.event_sender.clone(), daemon.obtain_signal_receiver());
tokio::spawn(async move {
agent.run().await;
});
}
#[cfg(target_os = "macos")]
async fn start_ipc_agent(daemon: &Daemon) {
// TODO: Implement macOS IPC agent.
}
#[cfg(not(any(target_os = "linux", target_os = "macos")))]
async fn start_ipc_agent(daemon: &Daemon) {
panic!("Unsupported IPC platform");
}
#[tokio::main]
async fn main() {
initialize_logging();
@@ -32,11 +53,8 @@ async fn main() {
})
.unwrap();
// Start the D-Bus agent (events in, signals out).
let agent = DBusAgent::new(daemon.event_sender.clone(), daemon.obtain_signal_receiver());
tokio::spawn(async move {
agent.run().await;
});
// Start the IPC agent.
start_ipc_agent(&daemon).await;
// Run the main daemon loop.
daemon.run().await;