summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2021-12-07 19:51:43 -0500
committerDan Davison <dandavison7@gmail.com>2021-12-07 21:40:42 -0500
commit0b3aefb48c139e7ae60796b989696ce2d83739c3 (patch)
treeec04dfc521c6e3978317056984a03ba9be558084
parente5eea75eee78bf66d16ff36fe41a1bd4032381b3 (diff)
Disable last-resort process tree inspection
See #824 in which some users are reporting very slow performance. Fixes #824
-rw-r--r--src/utils/process.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/utils/process.rs b/src/utils/process.rs
index 9dcee8d4..827e44de 100644
--- a/src/utils/process.rs
+++ b/src/utils/process.rs
@@ -275,6 +275,7 @@ trait ProcessInterface {
self.refresh_process(sibling_pid).then(|| ())?;
self.process(sibling_pid)
}
+ #[cfg(test)]
fn find_sibling_process<F, T>(&mut self, pid: Pid, extract_args: F) -> Option<T>
where
F: Fn(&[String]) -> ProcessArgs<T>,
@@ -425,11 +426,19 @@ where
567 | \_ less --RAW-CONTROL-CHARS --quit-if-one-screen
*/
- info.find_sibling_process(my_pid, extract_args)
+ #[cfg(test)]
+ {
+ info.find_sibling_process(my_pid, extract_args)
+ }
+ #[cfg(not(test))]
+ {
+ None
+ }
}
// Walk up the process tree, calling `f` with the pid and the distance to `starting_pid`.
// Prerequisite: `info.refresh_processes()` has been called.
+#[cfg(test)]
fn iter_parents<P, F>(info: &P, starting_pid: Pid, f: F)
where
P: ProcessInterface,