Skip to content

Commit

Permalink
Fix get_process_name func
Browse files Browse the repository at this point in the history
  • Loading branch information
containerscrew committed Jan 12, 2025
1 parent 5e81776 commit d467936
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion nflux/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,13 @@ pub fn lookup_address(ip: u32) -> String {
pub fn get_process_name(pid: u64) -> String {
let mut s = System::new_all();

// Is this causing overhead?
s.refresh_all();

match s.process(Pid::from(pid as usize)) {
Some(process) => {
format!("{:?}", process.name()).to_string()
// Get the process name. Remove "" when have spaces or other special characters
format!("{:?}", process.name()).to_string().trim_matches('"').to_string()
}
None => String::new(),
}
Expand Down

0 comments on commit d467936

Please sign in to comment.