mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-04-04 07:01:29 +03:00
fix: linux workaround cmd path (#12172)
Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
Submodule libs/hbb_common updated: 92ca2ca8be...3454fe8c60
@@ -5,7 +5,9 @@ use crate::lang::translate;
|
|||||||
use gtk::{glib, prelude::*};
|
use gtk::{glib, prelude::*};
|
||||||
use hbb_common::{
|
use hbb_common::{
|
||||||
anyhow::{bail, Error},
|
anyhow::{bail, Error},
|
||||||
log, ResultType,
|
log,
|
||||||
|
platform::linux::CMD_SH,
|
||||||
|
ResultType,
|
||||||
};
|
};
|
||||||
use nix::{
|
use nix::{
|
||||||
libc::{fcntl, kill},
|
libc::{fcntl, kill},
|
||||||
@@ -468,7 +470,7 @@ fn child(su_user: Option<String>, args: Vec<String>) -> ResultType<()> {
|
|||||||
if su_user.is_some() {
|
if su_user.is_some() {
|
||||||
params.push("-S".to_string());
|
params.push("-S".to_string());
|
||||||
}
|
}
|
||||||
params.push("/bin/sh".to_string());
|
params.push(CMD_SH.to_string());
|
||||||
params.push("-c".to_string());
|
params.push("-c".to_string());
|
||||||
|
|
||||||
let command = args
|
let command = args
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ use hbb_common::{
|
|||||||
libc::{c_char, c_int, c_long, c_void},
|
libc::{c_char, c_int, c_long, c_void},
|
||||||
log,
|
log,
|
||||||
message_proto::{DisplayInfo, Resolution},
|
message_proto::{DisplayInfo, Resolution},
|
||||||
|
platform::linux::{CMD_PS, CMD_SH},
|
||||||
regex::{Captures, Regex},
|
regex::{Captures, Regex},
|
||||||
};
|
};
|
||||||
use std::{
|
use std::{
|
||||||
@@ -320,7 +321,7 @@ fn set_x11_env(desktop: &Desktop) {
|
|||||||
#[inline]
|
#[inline]
|
||||||
fn stop_rustdesk_servers() {
|
fn stop_rustdesk_servers() {
|
||||||
let _ = run_cmds(&format!(
|
let _ = run_cmds(&format!(
|
||||||
r##"ps -ef | grep -E '{} +--server' | awk '{{printf("kill -9 %d\n", $2)}}' | bash"##,
|
r##"ps -ef | grep -E '{} +--server' | awk '{{print $2}}' | xargs -r kill -9"##,
|
||||||
crate::get_app_name().to_lowercase(),
|
crate::get_app_name().to_lowercase(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@@ -328,11 +329,11 @@ fn stop_rustdesk_servers() {
|
|||||||
#[inline]
|
#[inline]
|
||||||
fn stop_subprocess() {
|
fn stop_subprocess() {
|
||||||
let _ = run_cmds(&format!(
|
let _ = run_cmds(&format!(
|
||||||
r##"ps -ef | grep '/etc/{}/xorg.conf' | grep -v grep | awk '{{printf("kill -9 %d\n", $2)}}' | bash"##,
|
r##"ps -ef | grep '/etc/{}/xorg.conf' | grep -v grep | awk '{{print $2}}' | xargs -r kill -9"##,
|
||||||
crate::get_app_name().to_lowercase(),
|
crate::get_app_name().to_lowercase(),
|
||||||
));
|
));
|
||||||
let _ = run_cmds(&format!(
|
let _ = run_cmds(&format!(
|
||||||
r##"ps -ef | grep -E '{} +--cm-no-ui' | grep -v grep | awk '{{printf("kill -9 %d\n", $2)}}' | bash"##,
|
r##"ps -ef | grep -E '{} +--cm-no-ui' | grep -v grep | awk '{{print $2}}' | xargs -r kill -9"##,
|
||||||
crate::get_app_name().to_lowercase(),
|
crate::get_app_name().to_lowercase(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@@ -517,7 +518,8 @@ pub fn get_active_userid() -> String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn get_cm() -> bool {
|
fn get_cm() -> bool {
|
||||||
if let Ok(output) = Command::new("ps").args(vec!["aux"]).output() {
|
// We use `CMD_PS` instead of `ps` to suppress some audit messages on some systems.
|
||||||
|
if let Ok(output) = Command::new(CMD_PS.as_str()).args(vec!["aux"]).output() {
|
||||||
for line in String::from_utf8_lossy(&output.stdout).lines() {
|
for line in String::from_utf8_lossy(&output.stdout).lines() {
|
||||||
if line.contains(&format!(
|
if line.contains(&format!(
|
||||||
"{} --cm",
|
"{} --cm",
|
||||||
@@ -1355,7 +1357,8 @@ pub fn run_me_with(secs: u32) {
|
|||||||
.unwrap_or("".into())
|
.unwrap_or("".into())
|
||||||
.to_string_lossy()
|
.to_string_lossy()
|
||||||
.to_string();
|
.to_string();
|
||||||
std::process::Command::new("sh")
|
// We use `CMD_SH` instead of `sh` to suppress some audit messages on some systems.
|
||||||
|
std::process::Command::new(CMD_SH.as_str())
|
||||||
.arg("-c")
|
.arg("-c")
|
||||||
.arg(&format!("sleep {secs}; {exe}"))
|
.arg(&format!("sleep {secs}; {exe}"))
|
||||||
.spawn()
|
.spawn()
|
||||||
|
|||||||
Reference in New Issue
Block a user