mirror of
https://github.com/uutils/procps.git
synced 2026-05-06 06:06:43 -04:00
ps: Sort before dedup
dedup_by() only deduplicates consecutively identical elements, so `ps -A` is returning some processes twice.
This commit is contained in:
@@ -42,6 +42,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
proc_infos.extend(collector::process_collector(&matches, &snapshot));
|
||||
proc_infos.extend(collector::session_collector(&matches, &snapshot));
|
||||
|
||||
proc_infos.sort_by(|a, b| a.borrow().pid.cmp(&b.borrow().pid));
|
||||
proc_infos.dedup_by(|a, b| a.borrow().pid == b.borrow().pid);
|
||||
|
||||
sorting::sort(&mut proc_infos, &matches);
|
||||
|
||||
Reference in New Issue
Block a user