refactor: convert async functions to synchronous for service management

This commit is contained in:
Tunglies
2025-08-17 15:58:20 +08:00
Unverified
parent 6aec474c85
commit 7b35ee513a
4 changed files with 12 additions and 6 deletions

View File

@@ -24,5 +24,5 @@ mod platform {
/// Command exposed to Tauri
#[tauri::command]
pub async fn invoke_uwp_tool() -> CmdResult {
platform::invoke_uwp_tool()
platform::invoke_uwp_tool().await
}

View File

@@ -518,7 +518,10 @@ impl EventDrivenProxyManager {
#[cfg(target_os = "windows")]
{
Self::execute_sysproxy_command(&["pac", expected_url]).await;
logging_error!(
Type::System,
Self::execute_sysproxy_command(&["pac", expected_url])
);
}
}
@@ -531,7 +534,10 @@ impl EventDrivenProxyManager {
#[cfg(target_os = "windows")]
{
let address = format!("{}:{}", expected.host, expected.port);
Self::execute_sysproxy_command(&["global", &address, &expected.bypass]).await;
logging_error!(
Type::System,
Self::execute_sysproxy_command(&["global", &address, &expected.bypass])
);
}
}

View File

@@ -180,7 +180,7 @@ pub fn install_service() -> Result<()> {
}
#[cfg(target_os = "windows")]
pub async fn reinstall_service() -> Result<()> {
pub fn reinstall_service() -> Result<()> {
logging!(info, Type::Service, true, "reinstall service");
// 获取当前服务状态
@@ -308,7 +308,7 @@ pub fn install_service() -> Result<()> {
}
#[cfg(target_os = "linux")]
pub async fn reinstall_service() -> Result<()> {
pub fn reinstall_service() -> Result<()> {
logging!(info, Type::Service, true, "reinstall service");
// 获取当前服务状态

View File

@@ -34,7 +34,7 @@ pub fn restart_app() {
logging!(error, Type::Core, "Failed to get app handle for restart");
return;
};
std::thread::sleep(std::time::Duration::from_secs(1));
tokio::time::sleep(std::time::Duration::from_secs(1)).await;
tauri::process::restart(&app_handle.env());
});
}