1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//! # OS shutdown signal helper
//!
//! [`Supervisor::run`](crate::Supervisor::run) uses [`wait_for_shutdown_signal`] in static mode.
//! Dynamic mode through [`Supervisor::serve`](crate::Supervisor::serve) does not install this wait; the application decides when to call `shutdown`.
//!
//! This helper installs signal listeners and waits.
//! It does not publish events or cancel tasks.
//!
//! ## Unix Signals
//!
//! On Unix, it waits for the first of:
//! - `SIGINT`
//! - `SIGTERM`
//! - `SIGQUIT`
//!
//! ## Non-Unix Signals
//!
//! On other platforms, it waits for `tokio::signal::ctrl_c`.
//!
//! ## Errors
//!
//! An error means signal setup failed or, on a non-Unix platform, waiting failed.
//! It is not a shutdown signal.
/// Waits for a supported process shutdown signal.
///
/// Returns:
/// - `Ok(())` when a supported signal is received,
/// - `Err(e)` when a signal listener cannot be installed.
///
/// The result does not identify which signal arrived.
pub async
/// Waits until the process receives a shutdown signal.
///
/// Returns:
/// - `Ok(())` when Ctrl-C is received,
/// - `Err(e)` when signal waiting fails.
pub async