kordophoned sans kpcli building on macos
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user