From e17378c6b3e04acc12c4c6d58b2cfbcadbac90ba Mon Sep 17 00:00:00 2001 From: 21pages Date: Wed, 29 Nov 2023 11:51:55 +0800 Subject: [PATCH] fix macos and linux vm reboot Signed-off-by: 21pages --- src/server/connection.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/server/connection.rs b/src/server/connection.rs index b4da0e45e..a895798df 100644 --- a/src/server/connection.rs +++ b/src/server/connection.rs @@ -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)]