Update Rust crate sysinfo to 0.31.0 (#17733)

renovate[bot] , renovate[bot] , and Piotr Osiewicz created

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [sysinfo](https://redirect.github.com/GuillaumeGomez/sysinfo) |
workspace.dependencies | minor | `0.30.7` -> `0.31.0` |

---

### Release Notes

<details>
<summary>GuillaumeGomez/sysinfo (sysinfo)</summary>

###
[`v0.31.4`](https://redirect.github.com/GuillaumeGomez/sysinfo/blob/HEAD/CHANGELOG.md#0314)

[Compare
Source](https://redirect.github.com/GuillaumeGomez/sysinfo/compare/v0.31.3...v0.31.4)

-   macOS: Force memory cleanup in disk list retrieval.

###
[`v0.31.3`](https://redirect.github.com/GuillaumeGomez/sysinfo/blob/HEAD/CHANGELOG.md#0313)

[Compare
Source](https://redirect.github.com/GuillaumeGomez/sysinfo/compare/v0.31.2...v0.31.3)

-   Raspberry Pi: Fix temperature retrieval.

###
[`v0.31.2`](https://redirect.github.com/GuillaumeGomez/sysinfo/blob/HEAD/CHANGELOG.md#0312)

[Compare
Source](https://redirect.github.com/GuillaumeGomez/sysinfo/compare/v0.31.1...v0.31.2)

-   Remove `bstr` dependency (needed for rustc development).

###
[`v0.31.1`](https://redirect.github.com/GuillaumeGomez/sysinfo/blob/HEAD/CHANGELOG.md#0311)

[Compare
Source](https://redirect.github.com/GuillaumeGomez/sysinfo/compare/v0.31.0...v0.31.1)

-   Downgrade version of `memchr` (needed for rustc development).

###
[`v0.31.0`](https://redirect.github.com/GuillaumeGomez/sysinfo/blob/HEAD/CHANGELOG.md#0310)

[Compare
Source](https://redirect.github.com/GuillaumeGomez/sysinfo/compare/v0.30.13...v0.31.0)

-   Split crate in features to only enable what you need.
- Remove `System::refresh_process`, `System::refresh_process_specifics`
and `System::refresh_pids`
    methods.
- Add new argument of type `ProcessesToUpdate` to
`System::refresh_processes` and `System::refresh_processes_specifics`
methods.
-   Add new `NetworkData::ip_networks` method.
-   Add new `System::refresh_cpu_list` method.
-   Global CPU now only contains CPU usage.
-   Rename `TermalSensorType` to `ThermalSensorType`.
-   Process names is now an `OsString`.
-   Remove `System::global_cpu_info`.
-   Add `System::global_cpu_usage`.
- macOS: Fix invalid CPU computation when single processes are refreshed
one after the other.
-   Windows: Fix virtual memory computation.
-   Windows: Fix WoW64 parent process refresh.
-   Linux: Retrieve RSS (Resident Set Size) memory for cgroups.

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 3pm on Wednesday" in timezone
America/New_York, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

Release Notes:

- N/A

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC43NC4xIiwidXBkYXRlZEluVmVyIjoiMzguODAuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>

Change summary

Cargo.lock                      | 19 ++++---------------
Cargo.toml                      |  2 +-
crates/client/src/telemetry.rs  | 10 ++++++++--
crates/terminal/src/pty_info.rs | 15 ++++++++++-----
4 files changed, 23 insertions(+), 23 deletions(-)

Detailed changes

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"

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"

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"

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)