Skip to main content

setup_ctrlc_handler

Function setup_ctrlc_handler 

Source
pub fn setup_ctrlc_handler(input_handle: IOInputHandle)
Expand description

Ctrl+C handler that sends Veto signal.

Sets up a Ctrl+C handler that sends a Veto signal through the input handle.

ยงExample

use orcs_runtime::io::{IOPort, setup_ctrlc_handler};
use orcs_types::ChannelId;

#[tokio::main]
async fn main() {
    let channel_id = ChannelId::new();
    let (_port, input_handle, _output_handle) = IOPort::with_defaults(channel_id);

    setup_ctrlc_handler(input_handle.clone());

    // Ctrl+C will now send Veto signal through the input handle
}