feat: add opt_value
This commit is contained in:
12
src/main.rs
12
src/main.rs
@@ -35,14 +35,20 @@ lazy_static!{
|
|||||||
static ref CHECK_FAIL_MAP: Mutex<HashMap<String, u64>> = Mutex::new(HashMap::new());
|
static ref CHECK_FAIL_MAP: Mutex<HashMap<String, u64>> = Mutex::new(HashMap::new());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
macro_rules! opt_value {
|
||||||
|
($e: expr) => {
|
||||||
|
match $e {
|
||||||
|
Some(o) => o,
|
||||||
|
None => return,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
panic::set_hook(Box::new(|panic_info| {
|
panic::set_hook(Box::new(|panic_info| {
|
||||||
error!("Panic in running keeprunningd: {:?}", panic_info);
|
error!("Panic in running keeprunningd: {:?}", panic_info);
|
||||||
}));
|
}));
|
||||||
let keep_running_config = match parse_keep_running_config() {
|
let keep_running_config = opt_value!(parse_keep_running_config());
|
||||||
Some(c) => c, None => return,
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut the_file_lock = None;
|
let mut the_file_lock = None;
|
||||||
if let Some(ref lock_file) = keep_running_config.lock_file {
|
if let Some(ref lock_file) = keep_running_config.lock_file {
|
||||||
|
|||||||
Reference in New Issue
Block a user