Skip to content

Commit

Permalink
fix: MacOS service install error
Browse files Browse the repository at this point in the history
  • Loading branch information
MystiPanda committed Jul 16, 2024
1 parent 1a6f842 commit ff28aab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src-tauri/src/core/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions src/components/setting/mods/service-switcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down

0 comments on commit ff28aab

Please sign in to comment.