mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-29 00:00:11 +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 ctrlc = tokio_signal::ctrl_c(&core.handle());
|
||||||
let stream = core.run(ctrlc).unwrap();
|
let stream = core.run(ctrlc).unwrap();
|
||||||
|
|
||||||
|
println!("This program is now waiting for you to press Ctrl+C");
|
||||||
|
|
||||||
core.run(stream.for_each(|()| {
|
core.run(stream.for_each(|()| {
|
||||||
println!("Ctrl-C received!");
|
println!("Ctrl-C received!");
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
Reference in New Issue
Block a user