Skip to content

Commit

Permalink
Display 30 chars for process name
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangxp1998 committed Jan 3, 2020
1 parent 81ed29e commit ff16687
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/os/lsof_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ lazy_static! {
impl RawConnection {
pub fn new(raw_line: &str) -> Option<RawConnection> {
let raw_connection_iter = CONNECTION_REGEX.captures_iter(raw_line).filter_map(|cap| {
let process_name = String::from(cap.get(1).unwrap().as_str());
let process_name = String::from(cap.get(1).unwrap().as_str()).replace("\\x20", " ");
let protocol = String::from(cap.get(2).unwrap().as_str());
let local_port = String::from(cap.get(3).unwrap().as_str());
let ip = String::from(cap.get(4).unwrap().as_str());
Expand Down Expand Up @@ -62,7 +62,7 @@ impl RawConnection {
}

pub fn get_connections<'a>() -> RawConnections {
let content = run(&["-n", "-P", "-i4"]);
let content = run(&["-n", "-P", "-i4", "+c", "30"]);
RawConnections::new(content)
}

Expand Down

0 comments on commit ff16687

Please sign in to comment.