mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2024-11-16 11:42:21 +08:00
fix: MacOS service install error
This commit is contained in:
parent
1a6f842492
commit
ff28aab56e
|
@ -141,7 +141,8 @@ pub async fn install_service(passwd: String) -> Result<()> {
|
||||||
)
|
)
|
||||||
.output()?;
|
.output()?;
|
||||||
|
|
||||||
if output.stderr.len() > 0 {
|
// MacOS default outout "Password:" in stderr
|
||||||
|
if output.stderr.len() > 10 {
|
||||||
bail!(
|
bail!(
|
||||||
"failed to install service with error: {}",
|
"failed to install service with error: {}",
|
||||||
String::from_utf8_lossy(&output.stderr)
|
String::from_utf8_lossy(&output.stderr)
|
||||||
|
@ -247,7 +248,8 @@ pub async fn uninstall_service(passwd: String) -> Result<()> {
|
||||||
)
|
)
|
||||||
.output()?;
|
.output()?;
|
||||||
|
|
||||||
if output.stderr.len() > 0 {
|
// MacOS default outout "Password:" in stderr
|
||||||
|
if output.stderr.len() > 10 {
|
||||||
bail!(
|
bail!(
|
||||||
"failed to uninstall service with error: {}",
|
"failed to uninstall service with error: {}",
|
||||||
String::from_utf8_lossy(&output.stderr)
|
String::from_utf8_lossy(&output.stderr)
|
||||||
|
|
|
@ -40,6 +40,9 @@ export const ServiceSwitcher = (props: Props) => {
|
||||||
setServiceLoading(false);
|
setServiceLoading(false);
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
await mutate();
|
await mutate();
|
||||||
|
setTimeout(() => {
|
||||||
|
mutate();
|
||||||
|
}, 2000);
|
||||||
Notice.error(err.message || err.toString());
|
Notice.error(err.message || err.toString());
|
||||||
setServiceLoading(false);
|
setServiceLoading(false);
|
||||||
}
|
}
|
||||||
|
@ -57,6 +60,9 @@ export const ServiceSwitcher = (props: Props) => {
|
||||||
setUninstallServiceLoading(false);
|
setUninstallServiceLoading(false);
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
await mutate();
|
await mutate();
|
||||||
|
setTimeout(() => {
|
||||||
|
mutate();
|
||||||
|
}, 2000);
|
||||||
Notice.error(err.message || err.toString());
|
Notice.error(err.message || err.toString());
|
||||||
setUninstallServiceLoading(false);
|
setUninstallServiceLoading(false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user