#wait #exit #terminal #ctrl-c #user #tokio #async

terminal-wait-exit

wait user exit terminal, like Ctrl+C

1 stable release

1.0.0 Jun 13, 2024

#804 in Asynchronous

MIT license

3KB

terminal-wait-exit

wait user exit terminal, like Ctrl+C.

Usage

#[tokio::main]
async fn main() {
    // Spawn the server into a runtime
    tokio::spawn(async move {
        // work
        server.serve(service).await;
    });

    if let Err(e) = wait_exit::wait_exit().await {
        error!("Listening exit failed.{:?}", e);
    }

    stop_graceful();
}

Dependencies

~3–11MB
~107K SLoC