From 80b92ebe699cb7221df28e7e1710fd0c92c223c9 Mon Sep 17 00:00:00 2001 From: Joseph Montanaro Date: Tue, 20 Dec 2022 13:01:44 -0800 Subject: [PATCH] generalize pid conversion --- src-tauri/src/clientinfo.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src-tauri/src/clientinfo.rs b/src-tauri/src/clientinfo.rs index d05dd97..7e34eb9 100644 --- a/src-tauri/src/clientinfo.rs +++ b/src-tauri/src/clientinfo.rs @@ -1,5 +1,5 @@ use netstat2::{AddressFamilyFlags, ProtocolFlags, ProtocolSocketInfo}; -use sysinfo::{System, SystemExt, Pid, ProcessExt}; +use sysinfo::{System, SystemExt, Pid, PidExt, ProcessExt}; use serde::{Serialize, Deserialize}; use crate::errors::*; @@ -43,7 +43,7 @@ pub fn get_clients(local_port: u16) -> Result, ClientInfoError> { let mut clients = Vec::new(); let mut sys = System::new(); for p in get_associated_pids(local_port)? { - let pid = Pid::from(p as i32); + let pid = Pid::from_u32(p); sys.refresh_process(pid); let proc = sys.process(pid) .ok_or(ClientInfoError::PidNotFound)?;