mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-16 00:00:12 +02:00
signal: ctrl+C example: Prompt user to do something.
So we don't stay at a blank terminal without any feedback after `cargo run`
This commit is contained in:
committed by
Carl Lerche
parent
48eda3fe2f
commit
175f9afea9
@@ -10,6 +10,8 @@ fn main() {
|
||||
let ctrlc = tokio_signal::ctrl_c(&core.handle());
|
||||
let stream = core.run(ctrlc).unwrap();
|
||||
|
||||
println!("This program is now waiting for you to press Ctrl+C");
|
||||
|
||||
core.run(stream.for_each(|()| {
|
||||
println!("Ctrl-C received!");
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user