mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
This commit is contained in:
@@ -1275,7 +1275,7 @@ fn switch_service(stop: bool) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn uninstall_service(show_new_window: bool) -> bool {
|
||||
pub fn uninstall_service(show_new_window: bool, _: bool) -> bool {
|
||||
if !has_cmd("systemctl") {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ fn correct_app_name(s: &str) -> String {
|
||||
s
|
||||
}
|
||||
|
||||
pub fn uninstall_service(show_new_window: bool) -> bool {
|
||||
pub fn uninstall_service(show_new_window: bool, sync: bool) -> bool {
|
||||
// to-do: do together with win/linux about refactory start/stop service
|
||||
if !is_installed_daemon(false) {
|
||||
return false;
|
||||
@@ -232,7 +232,7 @@ pub fn uninstall_service(show_new_window: bool) -> bool {
|
||||
return false;
|
||||
};
|
||||
|
||||
std::thread::spawn(move || {
|
||||
let func = move || {
|
||||
match std::process::Command::new("osascript")
|
||||
.arg("-e")
|
||||
.arg(script_body)
|
||||
@@ -275,7 +275,12 @@ pub fn uninstall_service(show_new_window: bool) -> bool {
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
if sync {
|
||||
func();
|
||||
} else {
|
||||
std::thread::spawn(func);
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
@@ -515,7 +520,7 @@ pub fn start_os_service() {
|
||||
// https://emorydunn.github.io/LaunchAgent/Classes/LaunchAgent.html#/s:11LaunchAgentAAC16throttleIntervalSiSgvp,
|
||||
// by default, ThrottleInterval = 10, we changed it to 1
|
||||
if dt >= 0 {
|
||||
std::thread::sleep(std::time::Duration::from_secs(dt.clamp(3, 30) as _));
|
||||
std::thread::sleep(std::time::Duration::from_secs(dt.clamp(0, 15) as _));
|
||||
}
|
||||
log::info!("The others killed");
|
||||
std::process::exit(0);
|
||||
|
||||
@@ -8,8 +8,9 @@
|
||||
<true/>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>/Applications/RustDesk.app/Contents/MacOS/RustDesk</string>
|
||||
<string>--service</string>
|
||||
<string>/bin/sh</string>
|
||||
<string>-c</string>
|
||||
<string>sleep 1.5; /Applications/RustDesk.app/Contents/MacOS/RustDesk --service</string>
|
||||
</array>
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
|
||||
@@ -2302,7 +2302,7 @@ impl Drop for WakeLock {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn uninstall_service(show_new_window: bool) -> bool {
|
||||
pub fn uninstall_service(show_new_window: bool, _: bool) -> bool {
|
||||
log::info!("Uninstalling service...");
|
||||
let filter = format!(" /FI \"PID ne {}\"", get_current_pid());
|
||||
Config::set_option("stop-service".into(), "Y".into());
|
||||
|
||||
Reference in New Issue
Block a user