Skip to content

Commit

Permalink
we only need the first result
Browse files Browse the repository at this point in the history
  • Loading branch information
tsturzl committed May 24, 2021
1 parent c1da9bd commit 6d5157b
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/cgroups/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,13 @@ impl Manager {
let mount = Process::myself()?
.mountinfo()?
.into_iter()
.filter(|m| m.fs_type == "cgroup" && m.mount_point.ends_with(subsystem))
.collect::<Vec<_>>()
.pop()
.find(|m| m.fs_type == "cgroup" && m.mount_point.ends_with(subsystem))
.unwrap();

let cgroup = Process::myself()?
.cgroups()?
.into_iter()
.filter(|c| c.controllers.contains(&subsystem.to_owned()))
.collect::<Vec<_>>()
.pop()
.find(|c| c.controllers.contains(&subsystem.to_owned()))
.unwrap();

let p = if cgroup_path.to_string_lossy().into_owned().is_empty() {
Expand Down

0 comments on commit 6d5157b

Please sign in to comment.