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:
Jules Kerssemakers
2018-09-10 11:30:00 -07:00
committed by Carl Lerche
parent 48eda3fe2f
commit 175f9afea9
+2
View File
@@ -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(())