fix: adjust something

This commit is contained in:
GyDi 2022-04-25 20:00:11 +08:00 committed by GitHub
parent 5308970ad8
commit 557f5fe364
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 7 deletions

View File

@ -263,8 +263,10 @@ pub mod service {
#[tauri::command]
pub async fn install_service() -> Result<(), String> {
wrap_err!(crate::core::Service::install_service().await)?;
wrap_err!(crate::core::Service::start_service().await)
log_if_err!(crate::core::Service::install_service().await);
let ret = wrap_err!(crate::core::Service::start_service().await);
log::info!("clash verge service started successfully");
ret
}
#[tauri::command]

View File

@ -85,8 +85,7 @@ fn main() -> std::io::Result<()> {
}
"quit" => {
resolve::resolve_reset(app_handle);
api::process::kill_children();
std::process::exit(0);
app_handle.exit(0);
}
_ => {}
},

View File

@ -22,8 +22,11 @@ pub fn resolve_setup(app: &App) {
pub fn resolve_reset(app_handle: &AppHandle) {
let core = app_handle.state::<Core>();
let mut sysopt = core.sysopt.lock();
sysopt.reset_sysproxy();
drop(sysopt);
let mut service = core.service.lock();
crate::log_if_err!(service.stop());
}
/// customize the window theme

View File

@ -41,8 +41,8 @@ const ServiceMode = (props: Props) => {
try {
await installService();
mutate("checkService");
Notice.success("Service installed successfully");
onClose();
Notice.success("Service installed successfully");
} catch (err: any) {
mutate("checkService");
onError(err);
@ -56,9 +56,9 @@ const ServiceMode = (props: Props) => {
}
await uninstallService();
Notice.success("Service uninstalled successfully");
mutate("checkService");
onClose();
Notice.success("Service uninstalled successfully");
} catch (err: any) {
mutate("checkService");
onError(err);