fix opensuse

This commit is contained in:
rustdesk 2022-05-05 01:33:49 +08:00
parent b5395d954a
commit 6cfbbbc067
2 changed files with 3 additions and 0 deletions

View File

@ -510,6 +510,7 @@ fn start_pynput_service(rx: mpsc::Receiver<(PyMsg, bool)>) {
}
status = std::process::Command::new("sudo")
.args(vec![
"-E",
&format!("XDG_RUNTIME_DIR=/run/user/{}", userid) as &str,
"-u",
&username,

View File

@ -533,8 +533,10 @@ pub fn is_root() -> bool {
pub fn run_as_user(arg: &str) -> ResultType<Option<std::process::Child>> {
let uid = get_active_userid();
let cmd = std::env::current_exe()?;
// -E required for opensuse
let task = std::process::Command::new("sudo")
.args(vec![
"-E",
&format!("XDG_RUNTIME_DIR=/run/user/{}", uid) as &str,
"-u",
&get_active_username(),