mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 00:35:38 +08:00
Refactor async runtime usage with AsyncHandler wrapper
This commit is contained in:
@@ -49,7 +49,7 @@ pub fn open_devtools(app_handle: tauri::AppHandle) {
|
||||
/// 退出应用
|
||||
#[tauri::command]
|
||||
pub fn exit_app() {
|
||||
feat::quit(Some(0));
|
||||
feat::quit();
|
||||
}
|
||||
|
||||
/// 重启应用
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
use super::CmdResult;
|
||||
use crate::{config::*, core::*, feat, module::mihomo::MihomoManager, wrap_err};
|
||||
use crate::{
|
||||
config::*, core::*, feat, module::mihomo::MihomoManager, process::AsyncHandler, wrap_err,
|
||||
};
|
||||
use serde_yaml::Mapping;
|
||||
|
||||
/// 复制Clash环境变量
|
||||
@@ -104,10 +106,9 @@ pub fn apply_dns_config(apply: bool) -> CmdResult {
|
||||
core::{handle, CoreManager},
|
||||
utils::dirs,
|
||||
};
|
||||
use tauri::async_runtime;
|
||||
|
||||
// 使用spawn来处理异步操作
|
||||
async_runtime::spawn(async move {
|
||||
AsyncHandler::spawn(move || async move {
|
||||
if apply {
|
||||
// 读取DNS配置文件
|
||||
let dns_path = match dirs::app_home_dir() {
|
||||
|
||||
Reference in New Issue
Block a user