mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
@@ -324,7 +324,7 @@ pub fn start_os_service() {
|
||||
) {
|
||||
stop_rustdesk_servers();
|
||||
std::thread::sleep(std::time::Duration::from_millis(super::SERVICE_INTERVAL));
|
||||
match run_as_user("--server", Some((cur_uid, cur_user))) {
|
||||
match run_as_user(vec!["--server"], Some((cur_uid, cur_user))) {
|
||||
Ok(ps) => user_server = ps,
|
||||
Err(err) => {
|
||||
log::error!("Failed to start server: {}", err);
|
||||
@@ -566,7 +566,7 @@ fn is_opensuse() -> bool {
|
||||
}
|
||||
|
||||
pub fn run_as_user(
|
||||
arg: &str,
|
||||
arg: Vec<&str>,
|
||||
user: Option<(String, String)>,
|
||||
) -> ResultType<Option<std::process::Child>> {
|
||||
let (uid, username) = match user {
|
||||
@@ -575,7 +575,8 @@ pub fn run_as_user(
|
||||
};
|
||||
let cmd = std::env::current_exe()?;
|
||||
let xdg = &format!("XDG_RUNTIME_DIR=/run/user/{}", uid) as &str;
|
||||
let mut args = vec![xdg, "-u", &username, cmd.to_str().unwrap_or(""), arg];
|
||||
let mut args = vec![xdg, "-u", &username, cmd.to_str().unwrap_or("")];
|
||||
args.append(&mut arg.clone());
|
||||
// -E required for opensuse
|
||||
if is_opensuse() {
|
||||
args.insert(0, "-E");
|
||||
|
||||
Reference in New Issue
Block a user