Skip to main content

Module signals

Module signals 

Source
Expand description

This module provides a way to handle signals in a platform-independent way. It provides a way to convert signal names to their corresponding values and vice versa. It also provides a way to ignore the SIGINT signal and enable pipe errors.

Macros§

init_startup_state_capture
Initializes startup state capture. Call once at crate root level.

Statics§

ALL_SIGNALS
The list of all signals.
DEFAULT_SIGNAL
The default signal value.

Functions§

capture_startup_state
Captures stdio and SIGPIPE state at process initialization, before main() runs.
disable_pipe_errors
Ignores SIGPIPE signal (broken pipe errors are returned instead of terminating). Use this to override the default SIGPIPE handling when you need to handle broken pipe errors gracefully (e.g., tee with –output-error).
enable_pipe_errors
Restores SIGPIPE to default behavior (process terminates on broken pipe).
ensure_stdout_not_broken
ignore_interrupts
Ignores the SIGINT signal.
install_signal_handler
Installs a signal handler. The handler must be async-signal-safe.
is_signal
Returns true if the given number is a valid signal number.
signal_by_name_or_value
Returns the signal number for a given signal name or value.
signal_list_name_by_value
Returns the signal name for list-style interfaces.
signal_list_value_by_name_or_number
Returns the signal value for list-style interfaces.
signal_name_by_value
Returns the signal name for a given signal value.
signal_number_upper_bound
Returns the largest signal number that list-style interfaces should accept.
sigpipe_was_ignored
Returns whether SIGPIPE was ignored at process startup.
stderr_was_closed
stdin_was_closed
stdout_was_closed