Merge pull request #63 from quanweiZhou/fix_read_task_hang

fix: read task hang when the cgroup dir removed after open
This commit is contained in:
Tim Zhang
2021-11-11 11:09:35 +08:00
committed by GitHub
2 changed files with 9 additions and 4 deletions

View File

@@ -87,7 +87,7 @@ fn mountinfo_file(file: &mut File) -> Vec<Mountinfo> {
}
}
}
Err(_) => continue,
Err(_) => break,
}
}
r

View File

@@ -365,9 +365,14 @@ where
.map(|file| {
let bf = BufReader::new(file);
let mut v = Vec::new();
for line in bf.lines().flatten() {
let n = line.trim().parse().unwrap_or(0u64);
v.push(n);
for line in bf.lines() {
match line {
Ok(line) => {
let n = line.trim().parse().unwrap_or(0u64);
v.push(n);
}
Err(_) => break,
}
}
v.into_iter().map(CgroupPid::from).collect()
})