Skip to main content

debugger/daemon/
mod.rs

1//! Daemon mode - background process managing DAP adapter
2//!
3//! The daemon is spawned automatically by CLI commands and maintains
4//! persistent debug sessions across CLI invocations.
5
6mod handler;
7mod server;
8mod session;
9
10use crate::common::Result;
11
12/// Run in daemon mode
13///
14/// This is the entry point when the binary is invoked with the hidden `daemon` command.
15/// The daemon:
16/// 1. Creates an IPC socket/pipe for CLI connections
17/// 2. Accepts CLI commands and translates them to DAP requests
18/// 3. Buffers events when no client is connected
19/// 4. Manages the debug session lifecycle
20pub async fn run() -> Result<()> {
21    tracing::info!(
22        version = env!("CARGO_PKG_VERSION"),
23        pid = std::process::id(),
24        "Starting debugger daemon"
25    );
26
27    let mut daemon = server::Daemon::new().await?;
28    daemon.run().await
29}