mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 17:15:38 +08:00
refactor: use async instead of block_on
This commit is contained in:
@@ -15,8 +15,15 @@ use tauri::{api, SystemTray};
|
||||
|
||||
fn main() -> std::io::Result<()> {
|
||||
// 单例检测
|
||||
if server::check_singleton().is_err() {
|
||||
println!("app exists");
|
||||
let app_exists: bool = tauri::async_runtime::block_on(async move {
|
||||
if server::check_singleton().await.is_err() {
|
||||
println!("app exists");
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
});
|
||||
if app_exists {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
@@ -29,7 +36,9 @@ fn main() -> std::io::Result<()> {
|
||||
let mut builder = tauri::Builder::default()
|
||||
.system_tray(SystemTray::new())
|
||||
.setup(|app| {
|
||||
resolve::resolve_setup(app);
|
||||
tauri::async_runtime::block_on(async move {
|
||||
resolve::resolve_setup(app).await;
|
||||
});
|
||||
Ok(())
|
||||
})
|
||||
.on_system_tray_event(core::tray::Tray::on_system_tray_event)
|
||||
|
||||
Reference in New Issue
Block a user