Skip to content

Commit

Permalink
Count /dev/fd using std
Browse files Browse the repository at this point in the history
  • Loading branch information
hatoo committed Jan 31, 2024
1 parent fdc514d commit 59b5203
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions src/monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,19 +180,7 @@ impl Monitor {
bar_num_req.iter().map(|(a, b)| (a.as_str(), *b)).collect();

#[cfg(unix)]
let nofile = match tokio::fs::read_dir("/dev/fd").await {
Ok(mut dir) => {
let mut count = 0;
loop {
match dir.next_entry().await {
Ok(Some(_)) => count += 1,
Ok(None) => break Ok(count),
Err(err) => break Err(err),
}
}
}
Err(e) => Err(e),
};
let nofile = std::fs::read_dir("/dev/fd").map(|dir| dir.count());

terminal.draw(|f| {
let row4 = Layout::default()
Expand Down

0 comments on commit 59b5203

Please sign in to comment.