generated from milosgajdos/go-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* moved signal handling to its own Rust module * removed some comments in gobot Signed-off-by: Milos Gajdos <[email protected]>
- Loading branch information
1 parent
469d559
commit 5348ef9
Showing
4 changed files
with
19 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use crate::prelude::*; | ||
use tokio::{self, signal, sync::watch}; | ||
|
||
pub async fn trap(done: watch::Sender<bool>) -> Result<()> { | ||
tokio::select! { | ||
_ = signal::ctrl_c() => { | ||
println!("shutting down, received SIGINT signal..."); | ||
done.send(true)?; | ||
} | ||
} | ||
Ok(()) | ||
} |