fix some rare case
This commit is contained in:
parent
c844d99ff1
commit
da4669366b
@ -290,6 +290,7 @@ fn get_display() -> String {
|
|||||||
}
|
}
|
||||||
// above not work for gdm user
|
// above not work for gdm user
|
||||||
log::debug!("ls -l /tmp/.X11-unix/");
|
log::debug!("ls -l /tmp/.X11-unix/");
|
||||||
|
let mut last = "".to_owned();
|
||||||
if let Ok(output) = std::process::Command::new("ls")
|
if let Ok(output) = std::process::Command::new("ls")
|
||||||
.args(vec!["-l", "/tmp/.X11-unix/"])
|
.args(vec!["-l", "/tmp/.X11-unix/"])
|
||||||
.output()
|
.output()
|
||||||
@ -297,16 +298,18 @@ fn get_display() -> String {
|
|||||||
for line in String::from_utf8_lossy(&output.stdout).lines() {
|
for line in String::from_utf8_lossy(&output.stdout).lines() {
|
||||||
log::debug!(" {}", line);
|
log::debug!(" {}", line);
|
||||||
let mut iter = line.split_whitespace();
|
let mut iter = line.split_whitespace();
|
||||||
if iter.nth(2) == Some(&user) {
|
let user_field = iter.nth(2);
|
||||||
if let Some(x) = iter.last() {
|
if let Some(x) = iter.last() {
|
||||||
if x.starts_with("X") {
|
if x.starts_with("X") {
|
||||||
return x.replace("X", ":").to_owned();
|
last = x.replace("X", ":").to_owned();
|
||||||
|
if user_field == Some(&user) {
|
||||||
|
return last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"".to_owned()
|
last
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_value_of_seat0(i: usize) -> String {
|
fn get_value_of_seat0(i: usize) -> String {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user