use std::{thread, ops::Deref}; use common_uu::{restart::{restart, Env}, get_arg, JsonVExentd}; use once_cell::sync::Lazy; static time: Lazy = Lazy::new(|| { let t = chrono::Local::now().timestamp() as i32; println!("time init: {t}"); t }); /// 单元测试 linux windows, 传参数重启 OK: /// ./restart mode=test fn main(){ use std::process::{exit}; let t =time.deref(); if t % 2 == 0 { let mode = get_arg("mode").as_string2().unwrap_or_default(); println!("restart: {mode}"); exit(0); } restart(&Env::default()); // time.deref(); thread::sleep(std::time::Duration::from_secs(999)); }