pub fn init_ctrlc_with_print(message: &str) -> Result<()>Expand description
Initializes the SIGINT (Ctrl-C) signal handler with a custom message.
This function installs a minimal, signal-safe handler for SIGINT.
Once installed, any incoming Ctrl-C will set an internal flag and
print the specified message to stderr.
The flag can later be queried via is_ctrlc_received().
This function may be called multiple times; the signal handler will only be installed once. Repeated calls are safe and have no additional effect.
§Note
Use either this function OR init_ctrlc(), not both.
§Arguments
message- The message to print to stderr when Ctrl-C is pressed
§Errors
Returns an Err if the underlying system call (sigaction)
fails during handler installation. This typically indicates a
low-level OS error or permission issue.
§Examples
ctrlc_tiny::init_ctrlc_with_print("Ctrl+C pressed\n")?;
while !ctrlc_tiny::is_ctrlc_received() {
// Do work here
}