refactor: convert async functions to synchronous for service management
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
// 获取当前服务状态
|
||||
|
||||
@@ -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());
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user