From ff28aab56e45c9b28905e974a031f34cd9cf47be Mon Sep 17 00:00:00 2001 From: MystiPanda Date: Tue, 16 Jul 2024 12:55:34 +0800 Subject: [PATCH] fix: MacOS service install error --- src-tauri/src/core/service.rs | 6 ++++-- src/components/setting/mods/service-switcher.tsx | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src-tauri/src/core/service.rs b/src-tauri/src/core/service.rs index f98af6378..54a215ef9 100644 --- a/src-tauri/src/core/service.rs +++ b/src-tauri/src/core/service.rs @@ -141,7 +141,8 @@ pub async fn install_service(passwd: String) -> Result<()> { ) .output()?; - if output.stderr.len() > 0 { + // MacOS default outout "Password:" in stderr + if output.stderr.len() > 10 { bail!( "failed to install service with error: {}", String::from_utf8_lossy(&output.stderr) @@ -247,7 +248,8 @@ pub async fn uninstall_service(passwd: String) -> Result<()> { ) .output()?; - if output.stderr.len() > 0 { + // MacOS default outout "Password:" in stderr + if output.stderr.len() > 10 { bail!( "failed to uninstall service with error: {}", String::from_utf8_lossy(&output.stderr) diff --git a/src/components/setting/mods/service-switcher.tsx b/src/components/setting/mods/service-switcher.tsx index 6c00e0796..9dd2d5a6c 100644 --- a/src/components/setting/mods/service-switcher.tsx +++ b/src/components/setting/mods/service-switcher.tsx @@ -40,6 +40,9 @@ export const ServiceSwitcher = (props: Props) => { setServiceLoading(false); } catch (err: any) { await mutate(); + setTimeout(() => { + mutate(); + }, 2000); Notice.error(err.message || err.toString()); setServiceLoading(false); } @@ -57,6 +60,9 @@ export const ServiceSwitcher = (props: Props) => { setUninstallServiceLoading(false); } catch (err: any) { await mutate(); + setTimeout(() => { + mutate(); + }, 2000); Notice.error(err.message || err.toString()); setUninstallServiceLoading(false); }