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] #[tauri::command]
pub async fn install_service() -> Result<(), String> { pub async fn install_service() -> Result<(), String> {
wrap_err!(crate::core::Service::install_service().await)?; log_if_err!(crate::core::Service::install_service().await);
wrap_err!(crate::core::Service::start_service().await) let ret = wrap_err!(crate::core::Service::start_service().await);
log::info!("clash verge service started successfully");
ret
} }
#[tauri::command] #[tauri::command]

View File

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

View File

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

View File

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