Skip to content

Commit

Permalink
Merge pull request #1431 from GuillaumeGomez/dead-procs
Browse files Browse the repository at this point in the history
Make `System::refresh_all` and `System::refresh_specifics` remove dead processes and update docs
  • Loading branch information
GuillaumeGomez authored Dec 17, 2024
2 parents b290678 + 4babe47 commit fb258d5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/common/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ impl System {
/// Refreshes according to the given [`RefreshKind`]. It calls the corresponding
/// "refresh_" methods.
///
/// It will remove dead processes if [`RefreshKind::processes`] returns `Some`.
/// If you want to keep dead processes, use [`System::refresh_processes_specifics`]
/// directly.
///
/// ```
/// use sysinfo::{ProcessRefreshKind, RefreshKind, System};
///
Expand All @@ -109,7 +113,7 @@ impl System {
self.refresh_cpu_specifics(kind);
}
if let Some(kind) = refreshes.processes() {
self.refresh_processes_specifics(ProcessesToUpdate::All, false, kind);
self.refresh_processes_specifics(ProcessesToUpdate::All, true, kind);
}
}

Expand All @@ -120,6 +124,9 @@ impl System {
/// Don't forget to take a look at [`ProcessRefreshKind::everything`] method to see what it
/// will update for processes more in details.
///
/// It will remove dead processes. If you want to keep dead processes, use
/// [`System::refresh_processes_specifics`] directly.
///
/// ```no_run
/// use sysinfo::System;
///
Expand Down

0 comments on commit fb258d5

Please sign in to comment.