fix: read task hang when the cgroup dir removed after open

Fixes #62
Signed-off-by: quanweiZhou <quanweiZhou@linux.alibaba.com>
This commit is contained in:
quanwei.zqw
2021-11-10 10:51:11 +08:00
committed by quanweiZhou
parent 0233c1e046
commit fb55383273
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()
})