fix mac uninstall service

This commit is contained in:
rustdesk 2023-09-04 16:22:56 +08:00
parent cd2541a9d2
commit 8235bca664

View File

@ -240,6 +240,11 @@ pub fn uninstall_service(show_new_window: bool) -> bool {
uninstalled uninstalled
); );
if uninstalled { if uninstalled {
if !show_new_window {
let _ = crate::ipc::close_all_instances();
// leave ipc a little time
std::thread::sleep(std::time::Duration::from_millis(300));
}
crate::ipc::set_option("stop-service", "Y"); crate::ipc::set_option("stop-service", "Y");
std::process::Command::new("launchctl") std::process::Command::new("launchctl")
.args(&["remove", &format!("{}_server", crate::get_full_name())]) .args(&["remove", &format!("{}_server", crate::get_full_name())])
@ -255,13 +260,6 @@ pub fn uninstall_service(show_new_window: bool) -> bool {
.spawn() .spawn()
.ok(); .ok();
} }
std::process::Command::new("pkill")
.arg(crate::get_app_name())
.status()
.ok();
let _ = crate::ipc::close_all_instances();
// leave ipc a little time
std::thread::sleep(std::time::Duration::from_millis(300));
quit_gui(); quit_gui();
} }
} }