Skip to content

Commit

Permalink
workaround for weird empty comm bug
Browse files Browse the repository at this point in the history
  • Loading branch information
bjia56 committed Jan 19, 2025
1 parent f888a49 commit 1cdd0ec
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/linux/cosmotop_collect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3303,7 +3303,9 @@ namespace Proc {
auto& new_proc = *find_old;

//? Get program name, command and username
if (no_cache) {
// weirdly enough, sometimes the proc entry exists but the name disappears,
// so we need to check if the name is empty and re-read from /proc
if (no_cache or new_proc.name.empty()) {
pread.open(d.path() / "comm");
if (not pread.good()) continue;
getline(pread, new_proc.name);
Expand Down

0 comments on commit 1cdd0ec

Please sign in to comment.