Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Fix duplicate process entries in WSL debug attach list (#40591)
feeiyuf213f4bcc8b6
diff --git a/crates/debugger_ui/src/attach_modal.rs b/crates/debugger_ui/src/attach_modal.rsindex daa83f71b1c..e39a842f635 100644--- a/crates/debugger_ui/src/attach_modal.rs+++ b/crates/debugger_ui/src/attach_modal.rs@@ -9,7 +9,7 @@ use task::ZedDebugConfig;use util::debug_panic;use std::sync::Arc;-use sysinfo::System;+use sysinfo::{ProcessRefreshKind, RefreshKind, System, UpdateKind};use ui::{Context, Tooltip, prelude::*};use ui::{ListItem, ListItemSpacing};use workspace::{ModalView, Workspace};@@ -362,7 +362,12 @@ fn get_processes_for_project(project: &Entity<Project>, cx: &mut App) -> Task<ArArc::from(processes.into_boxed_slice())})} else {- let mut processes: Box<[_]> = System::new_all()+ let refresh_kind = RefreshKind::nothing().with_processes(+ ProcessRefreshKind::nothing()+ .without_tasks()+ .with_cmd(UpdateKind::Always),+ );+ let mut processes: Box<[_]> = System::new_with_specifics(refresh_kind).processes().values().map(|process| {diff --git a/crates/remote_server/src/headless_project.rs b/crates/remote_server/src/headless_project.rsindex 83000c8bac3..f9531df2878 100644--- a/crates/remote_server/src/headless_project.rs+++ b/crates/remote_server/src/headless_project.rs@@ -32,7 +32,7 @@ use std::{path::{Path, PathBuf},sync::{Arc, atomic::AtomicUsize},};-use sysinfo::System;+use sysinfo::{ProcessRefreshKind, RefreshKind, System, UpdateKind};use util::{ResultExt, paths::PathStyle, rel_path::RelPath};use worktree::Worktree;@@ -747,9 +747,16 @@ impl HeadlessProject {_cx: AsyncApp,) -> Result<proto::GetProcessesResponse> {let mut processes = Vec::new();- let system = System::new_all();+ let refresh_kind = RefreshKind::nothing().with_processes(+ ProcessRefreshKind::nothing()+ .without_tasks()+ .with_cmd(UpdateKind::Always),+ );- for (_pid, process) in system.processes() {+ for process in System::new_with_specifics(refresh_kind)+ .processes()+ .values()+ {let name = process.name().to_string_lossy().into_owned();let command = process.cmd()