| Crates.io | sigterm |
| lib.rs | sigterm |
| version | 0.3.9 |
| created_at | 2026-01-25 12:34:08.329868+00 |
| updated_at | 2026-01-25 16:06:13.757919+00 |
| description | Signal-aware async control and cancellation primitives for Tokio. |
| homepage | |
| repository | https://github.com/canmi21/sigterm.git |
| max_upload_size | |
| id | 2068611 |
| size | 33,139 |
Signal-aware async control and cancellation primitives for Tokio.
sigterm abstracts away the boilerplate of listening for system signals (Ctrl+C, SIGTERM, etc.) and coordinating shutdown across multiple asynchronous tasks.
Ctrl+C or SIGTERM across platforms with a single await. Use try_wait() for non-panicking version.tokio-util.Shutdown: One-shot channel for single-task termination.Broadcast: Notify multiple subscribers of a shutdown event.ShutdownGuard: RAII guard that triggers shutdown when dropped (useful for panics).shutdown_signal() helper designed for seamless integration with axum::serve.SIGHUP, SIGQUIT, etc.) on Unix systems.Check the examples directory for runnable code:
examples/simple.rs - Wait for a simple shutdown signal.examples/shutdown_signal.rs - Combine system signals with internal cancellation (e.g., for Axum).examples/broadcast.rs - Coordinate multiple workers.examples/cancellation.rs - Manage tree-structured tasks.examples/guard.rs - Ensure shutdown on exit or panic.[dependencies]
sigterm = { version = "0.3", features = ["full"] }
Released under the MIT License © 2026 Canmi