make whole programm exit on worker thread crash
This commit is contained in:
parent
7425321510
commit
af130cf56e
@ -1,5 +1,3 @@
|
|||||||
// #![allow(unused)]
|
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
fmt::Debug,
|
fmt::Debug,
|
||||||
fs::File,
|
fs::File,
|
||||||
@ -93,6 +91,13 @@ impl Config {
|
|||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> anyhow::Result<()> {
|
async fn main() -> anyhow::Result<()> {
|
||||||
|
// make whole programm exit on worker thread crash
|
||||||
|
let default_panic = std::panic::take_hook();
|
||||||
|
std::panic::set_hook(Box::new(move |info| {
|
||||||
|
default_panic(info);
|
||||||
|
std::process::exit(1);
|
||||||
|
}));
|
||||||
|
|
||||||
let config = Arc::new(Config::load("config.json")?);
|
let config = Arc::new(Config::load("config.json")?);
|
||||||
|
|
||||||
if config.allowed_ports.is_empty() {
|
if config.allowed_ports.is_empty() {
|
||||||
|
Loading…
Reference in New Issue
Block a user