Skip to content

Commit 8edbe40

Browse files
committed
ps: Properly implement -d flag
1 parent 701333c commit 8edbe40

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/uu/ps/src/collector.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,14 @@ pub(crate) fn session_collector(
8585
let tty = |proc: &Rc<RefCell<ProcessInformation>>| proc.borrow_mut().tty();
8686

8787
// flag `-d`
88-
// TODO: Implementation this collection, guessing it pid=sid
8988
if matches.get_flag("d") {
90-
proc_snapshot.iter().for_each(|_| {});
89+
for proc_info in proc_snapshot {
90+
let pid = proc_info.borrow().pid;
91+
92+
if getsid(pid as i32) != Some(pid as i32) {
93+
result.push(proc_info.clone());
94+
}
95+
}
9196
}
9297

9398
// flag `-a`

0 commit comments

Comments
 (0)