From 26150ace8dfabc9e9c6f85a2e0f65afcd17c7c35 Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Sun, 2 Nov 2025 22:19:39 +0200 Subject: [PATCH] ps: Exit with status 1 if no process matched For example, `ps --deselect -A` or `ps --pid` for non existing pid trigger this. --- src/uu/ps/src/ps.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/uu/ps/src/ps.rs b/src/uu/ps/src/ps.rs index 1159ef3..8c3b759 100644 --- a/src/uu/ps/src/ps.rs +++ b/src/uu/ps/src/ps.rs @@ -35,6 +35,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { let selection_settings = ProcessSelectionSettings::from_matches(&matches); let mut proc_infos = selection_settings.select_processes()?; + if proc_infos.is_empty() { + uucore::error::set_exit_code(1); + } sorting::sort(&mut proc_infos, &matches);