atuinsh/atuin · error

failed to listen for ctrl+c

Error message

failed to listen for ctrl+c

What it means

The non-Unix branch of `shutdown_signal()` awaits `tokio::signal::ctrl_c()`, which panics if the Ctrl+C listener cannot be installed. On Windows this means the console control handler registration failed.

Solutions

  1. Run the daemon in an environment with an attached console for development
  2. Use proper Windows service/SCM shutdown handling instead of relying on Ctrl+C
  3. Enable tokio's `signal` feature in Cargo.toml
  4. Prefer the Unix build path (WSL) where signal handling is better supported
Defensive patterns

Strategy: try-catch

Try / catch

tokio::signal::ctrl_c().await.map_err(|e| BootError::CtrlC(e))?;

Prevention

When it happens

Trigger: Daemon `boot()` on a non-Unix platform when `ctrl_c()` registration fails — typically no attached console (detached/service process) or unsupported runtime configuration.

Common situations: Running the daemon as a Windows service or scheduled task with no console; launching via a process wrapper that detaches from the console; tokio runtime without the signal feature.

Related errors


AI-assisted analysis of atuinsh/atuin@c0c717ab04 (2026-09-12). Data as JSON: /api/errors/b6fdb4f50dda7128. Report an issue: GitHub.

Appendix: source

Thrown at crates/atuin-daemon/src/lib.rs:148

/// Wait for a shutdown signal (Ctrl+C or SIGTERM).
#[cfg(unix)]
async fn shutdown_signal() {
    let mut term = tokio::signal::unix::signal(tokio::signal::unix::SignalKind::terminate())
        .expect("failed to register sigterm handler");
    let mut int = tokio::signal::unix::signal(tokio::signal::unix::SignalKind::interrupt())
        .expect("failed to register sigint handler");

    tokio::select! {
        _ = term.recv() => {},
        _ = int.recv() => {},
    }
}

/// Wait for a shutdown signal (Ctrl+C).
#[cfg(not(unix))]
async fn shutdown_signal() {
    tokio::signal::ctrl_c().await.expect("failed to listen for ctrl+c");
}

View on GitHub (pinned to c0c717ab04)