Merge pull request #6562 from 21pages/force_reboot

fix macos and linux vm reboot
This commit is contained in:
RustDesk 2023-11-29 22:57:38 +08:00 committed by GitHub
commit 72ef3c3394
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2130,14 +2130,20 @@ impl Connection {
return false;
}
Some(misc::Union::RestartRemoteDevice(_)) =>
{
Some(misc::Union::RestartRemoteDevice(_)) => {
#[cfg(not(any(target_os = "android", target_os = "ios")))]
if self.restart {
// force_reboot, not work on linux vm and macos 14
#[cfg(any(target_os = "linux", target_os = "windows"))]
match system_shutdown::force_reboot() {
Ok(_) => log::info!("Restart by the peer"),
Err(e) => log::error!("Failed to restart: {}", e),
}
#[cfg(any(target_os = "linux", target_os = "macos"))]
match system_shutdown::reboot() {
Ok(_) => log::info!("Restart by the peer"),
Err(e) => log::error!("Failed to restart: {}", e),
}
}
}
#[cfg(windows)]