feat: add opt_value

This commit is contained in:
2020-10-18 23:11:25 +08:00
parent bd82cff4f1
commit f722c95432

View File

@@ -35,14 +35,20 @@ lazy_static!{
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() {
panic::set_hook(Box::new(|panic_info| {
error!("Panic in running keeprunningd: {:?}", panic_info);
}));
let keep_running_config = match parse_keep_running_config() {
Some(c) => c, None => return,
};
let keep_running_config = opt_value!(parse_keep_running_config());
let mut the_file_lock = None;
if let Some(ref lock_file) = keep_running_config.lock_file {