small tweak

This commit is contained in:
rustdesk
2022-04-28 12:10:14 +08:00
parent 0b6155bab8
commit de44e45ed6
2 changed files with 12 additions and 3 deletions

View File

@@ -145,7 +145,7 @@ pub fn is_installed_daemon(prompt: bool) -> bool {
.args(&["load", "-w", &agent_plist_file])
.status()
.ok();
std::process::exit(0);
quit_gui();
}
}
}
@@ -183,6 +183,8 @@ pub fn uninstall() -> bool {
);
if uninstalled {
crate::ipc::set_option("stop-service", "Y");
// leave ipc a little time
std::thread::sleep(std::time::Duration::from_millis(300));
std::process::Command::new("launchctl")
.args(&["remove", &format!("{}_server", crate::get_full_name())])
.status()
@@ -202,7 +204,7 @@ pub fn uninstall() -> bool {
))
.spawn()
.ok();
std::process::exit(0);
quit_gui();
}
}
}
@@ -517,3 +519,10 @@ pub fn is_installed() -> bool {
}
false
}
fn quit_gui() {
use cocoa::appkit::NSApp;
unsafe {
let () = msg_send!(NSApp(), terminate: nil);
};
}