Skip to content

Commit

Permalink
Merge pull request #394 from hatoo/count-fd
Browse files Browse the repository at this point in the history
Count /dev/fd using std
  • Loading branch information
hatoo authored Jan 31, 2024
2 parents fdc514d + 59b5203 commit 357960e
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 357960e

Please sign in to comment.