diff options
author | cyqsimon <28627918+cyqsimon@users.noreply.github.com> | 2023-08-25 13:26:31 +0800 |
---|---|---|
committer | cyqsimon <28627918+cyqsimon@users.noreply.github.com> | 2023-08-25 13:26:31 +0800 |
commit | 1891892b39cdfabbaea0b5c95da390b6351b4f8f (patch) | |
tree | 9269cad6ae075649579185af1d75fc3739163f92 | |
parent | bcb690563c91596fc1127c5f57791fdc92a04ede (diff) |
Fix windows build
-rw-r--r-- | src/os/windows.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/os/windows.rs b/src/os/windows.rs index 69adfde..5bb6118 100644 --- a/src/os/windows.rs +++ b/src/os/windows.rs @@ -1,11 +1,10 @@ -use ::std::collections::HashMap; +use std::collections::HashMap; -use ::sysinfo::ProcessExt; use netstat2::*; +use sysinfo::{Pid, PidExt, ProcessExt, System, SystemExt}; use crate::network::{LocalSocket, Protocol}; use crate::OpenSockets; -use sysinfo::{Pid, System, SystemExt}; pub(crate) fn get_open_sockets() -> OpenSockets { let mut open_sockets = HashMap::new(); @@ -21,7 +20,7 @@ pub(crate) fn get_open_sockets() -> OpenSockets { for si in sockets_info { let mut procname = String::new(); for pid in si.associated_pids { - if let Some(process) = sysinfo.get_process(pid as Pid) { + if let Some(process) = sysinfo.process(Pid::from_u32(pid)) { procname = String::from(process.name()); break; } |