fix build

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2023-03-31 17:49:35 +08:00
parent ee3ac31083
commit 571c1df5c4
4 changed files with 6 additions and 17 deletions

View File

@ -226,11 +226,11 @@ fn stop_rustdesk_servers() {
}
#[inline]
fn stop_xorg_subprocess() {
fn stop_subprocess() {
let _ = run_cmds(&format!(
r##"ps -ef | grep '/etc/rustdesk/xorg.conf' | grep -v grep | awk '{{printf("kill -9 %d\n", $2)}}' | bash"##,
));
let _ = run_cmds(format!(
let _ = run_cmds(&format!(
r##"ps -ef | grep -E 'rustdesk +--cm-no-ui' | grep -v grep | awk '{{printf("kill -9 %d\n", $2)}}' | bash"##,
));
}
@ -797,16 +797,6 @@ mod desktop {
super::is_gdm_user(&self.username) && self.protocal == DISPLAY_SERVER_WAYLAND
}
#[inline]
pub fn is_headless(&self) -> bool {
self.sid.is_empty()
}
#[inline]
pub fn is_login_wayland(&self) -> bool {
super::is_gdm_user(&self.username) && self.protocal == DISPLAY_SERVER_WAYLAND
}
#[inline]
pub fn is_headless(&self) -> bool {
self.sid.is_empty() || self.is_rustdesk_subprocess

View File

@ -373,7 +373,7 @@ impl DesktopManager {
fn wait_x_server_running(pid: u32, display_num: u32, max_wait_secs: u64) -> ResultType<()> {
let wait_begin = Instant::now();
loop {
if run_cmds(format!("ls /proc/{}", pid))?.is_empty() {
if run_cmds(&format!("ls /proc/{}", pid))?.is_empty() {
bail!("X server exit");
}

View File

@ -915,7 +915,7 @@ impl Connection {
}
#[cfg(target_os = "linux")]
if !self.file_transfer.is_some() && !self.port_forward_socket.is_some() {
let (_, dtype) = crate::platform::linux::get_user_and_display_server();
let dtype = crate::platform::linux::get_display_server();
if dtype != crate::platform::linux::DISPLAY_SERVER_X11
&& dtype != crate::platform::linux::DISPLAY_SERVER_WAYLAND
{
@ -2222,7 +2222,7 @@ async fn start_ipc(
username = linux_desktop_manager::get_username();
}
let uid = {
let output = run_cmds(format!("id -u {}", &username))?;
let output = run_cmds(&format!("id -u {}", &username))?;
let output = output.trim();
if output.is_empty() || !output.parse::<i32>().is_ok() {
bail!("Invalid username {}", &username);

View File

@ -511,9 +511,8 @@ pub fn get_error() -> String {
#[cfg(not(any(feature = "cli")))]
#[cfg(target_os = "linux")]
{
let (username, dtype) = crate::platform::linux::get_user_and_display_server();
let dtype = crate::platform::linux::get_display_server();
if crate::platform::linux::DISPLAY_SERVER_WAYLAND == dtype
&& !crate::platform::linux::is_gdm_user(&username)
{
return crate::server::wayland::common_get_error();
}