{"record":{"id":"b6fdb4f50dda7128","repo":"atuinsh/atuin","slug":"failed-to-listen-for-ctrl-c","errorCode":null,"errorMessage":"failed to listen for ctrl+c","messagePattern":"failed to listen for ctrl\\+c","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/atuin-daemon/src/lib.rs","lineNumber":148,"sourceCode":"\n/// Wait for a shutdown signal (Ctrl+C or SIGTERM).\n#[cfg(unix)]\nasync fn shutdown_signal() {\n    let mut term = tokio::signal::unix::signal(tokio::signal::unix::SignalKind::terminate())\n        .expect(\"failed to register sigterm handler\");\n    let mut int = tokio::signal::unix::signal(tokio::signal::unix::SignalKind::interrupt())\n        .expect(\"failed to register sigint handler\");\n\n    tokio::select! {\n        _ = term.recv() => {},\n        _ = int.recv() => {},\n    }\n}\n\n/// Wait for a shutdown signal (Ctrl+C).\n#[cfg(not(unix))]\nasync fn shutdown_signal() {\n    tokio::signal::ctrl_c().await.expect(\"failed to listen for ctrl+c\");\n}\n","sourceCodeStart":130,"sourceCodeEnd":150,"githubUrl":"https://github.com/atuinsh/atuin/blob/c0c717ab04c881764bcad4b3d169a507e2432643/crates/atuin-daemon/src/lib.rs#L130-L150","documentation":"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.","triggerScenarios":"Daemon `boot()` on a non-Unix platform when `ctrl_c()` registration fails — typically no attached console (detached/service process) or unsupported runtime configuration.","commonSituations":"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.","solutions":["Run the daemon in an environment with an attached console for development","Use proper Windows service/SCM shutdown handling instead of relying on Ctrl+C","Enable tokio's `signal` feature in Cargo.toml","Prefer the Unix build path (WSL) where signal handling is better supported"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"tokio::signal::ctrl_c().await.map_err(|e| BootError::CtrlC(e))?;","preventionTips":["Don't rely on Ctrl+C for shutdown in Windows services — use SCM stop events","Keep a console attached when debugging the daemon on Windows","Prefer running the daemon under WSL for consistent signal semantics"],"tags":["signal","windows","tokio","panic"],"backgroundTag":"module-init-failed","analyzedSha":"c0c717ab04c881764bcad4b3d169a507e2432643","analyzedAt":"2026-09-12T07:40:01.341Z","contentChangedAt":"2026-09-12T07:40:01.341Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}