diff --git a/Cargo.lock b/Cargo.lock index 9cff895393..930415440b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11085,17 +11085,16 @@ dependencies = [ [[package]] name = "sysinfo" -version = "0.30.13" +version = "0.31.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a5b4ddaee55fb2bea2bf0e5000747e5f5c0de765e5a5ff87f4cd106439f4bb3" +checksum = "355dbe4f8799b304b05e1b0f05fc59b2a18d36645cf169607da45bde2f69a1be" dependencies = [ - "cfg-if", "core-foundation-sys", "libc", + "memchr", "ntapi", - "once_cell", "rayon", - "windows 0.52.0", + "windows 0.54.0", ] [[package]] @@ -13443,16 +13442,6 @@ dependencies = [ "windows-targets 0.48.5", ] -[[package]] -name = "windows" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" -dependencies = [ - "windows-core 0.52.0", - "windows-targets 0.52.6", -] - [[package]] name = "windows" version = "0.54.0" diff --git a/Cargo.toml b/Cargo.toml index eea510edf2..0b392e02eb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -416,7 +416,7 @@ strsim = "0.11" strum = { version = "0.25.0", features = ["derive"] } subtle = "2.5.0" sys-locale = "0.3.1" -sysinfo = "0.30.7" +sysinfo = "0.31.0" tempfile = "3.9.0" thiserror = "1.0.29" tiktoken-rs = "0.5.9" diff --git a/crates/client/src/telemetry.rs b/crates/client/src/telemetry.rs index 860288038b..b415cae14c 100644 --- a/crates/client/src/telemetry.rs +++ b/crates/client/src/telemetry.rs @@ -304,7 +304,10 @@ impl Telemetry { let refresh_kind = ProcessRefreshKind::new().with_cpu().with_memory(); let current_process = Pid::from_u32(std::process::id()); - system.refresh_process_specifics(current_process, refresh_kind); + system.refresh_processes_specifics( + sysinfo::ProcessesToUpdate::Some(&[current_process]), + refresh_kind, + ); // Waiting some amount of time before the first query is important to get a reasonable value // https://docs.rs/sysinfo/0.29.10/sysinfo/trait.ProcessExt.html#tymethod.cpu_usage @@ -314,7 +317,10 @@ impl Telemetry { smol::Timer::after(DURATION_BETWEEN_SYSTEM_EVENTS).await; let current_process = Pid::from_u32(std::process::id()); - system.refresh_process_specifics(current_process, refresh_kind); + system.refresh_processes_specifics( + sysinfo::ProcessesToUpdate::Some(&[current_process]), + refresh_kind, + ); let Some(process) = system.process(current_process) else { log::error!( "Failed to find own process {current_process:?} in system process table" diff --git a/crates/terminal/src/pty_info.rs b/crates/terminal/src/pty_info.rs index 5fc3b05f78..559d022fda 100644 --- a/crates/terminal/src/pty_info.rs +++ b/crates/terminal/src/pty_info.rs @@ -98,9 +98,10 @@ impl PtyProcessInfo { fn refresh(&mut self) -> Option<&Process> { let pid = self.pid_getter.pid()?; - if self - .system - .refresh_process_specifics(pid, self.refresh_kind) + if self.system.refresh_processes_specifics( + sysinfo::ProcessesToUpdate::Some(&[pid]), + self.refresh_kind, + ) == 1 { self.system.process(pid) } else { @@ -116,9 +117,13 @@ impl PtyProcessInfo { .map_or(PathBuf::new(), |p| p.to_owned()); let info = ProcessInfo { - name: process.name().to_owned(), + name: process.name().to_str()?.to_owned(), cwd, - argv: process.cmd().to_vec(), + argv: process + .cmd() + .iter() + .filter_map(|s| s.to_str().map(ToOwned::to_owned)) + .collect(), }; self.current = Some(info.clone()); Some(info)