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 signals.
//!
//! Provides [`wait_for_shutdown_signal`], an async helper used by `Supervisor::run` to wait for a process shutdown signal.
//!
//! This module only waits for OS signals.
//! It does not publish runtime events, cancel tasks, or start shutdown by itself.
//! The caller decides how to handle `Ok(())` and `Err(_)`.
//!
//! ## Unix Signals
//!
//! On Unix platforms, the helper waits for the first of:
//! - `SIGINT`
//! - `SIGTERM`
//! - `SIGQUIT`
//!
//! ## Non-Unix Signals
//!
//! On non-Unix platforms, the helper waits for `tokio::signal::ctrl_c`.
//!
//! ## Errors
//!
//! `Err` means signal listener setup or waiting failed.
//! It must not be treated as a normal shutdown signal.
/// Waits until the process receives a shutdown signal.
///
/// Returns:
/// - `Ok(())` when a supported signal is received,
/// - `Err(e)` when signal listener setup or waiting fails.
///
/// The returned value does not include which signal was received.
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