From 8706c88370c417a94fcfefd47b21fbe92b5a4ed4 Mon Sep 17 00:00:00 2001 From: Tim Ledbetter Date: Tue, 30 May 2023 17:51:06 +0100 Subject: [PATCH] pgrep: Return 1 rather than 0 if there are no matches This matches the behavior of `pgrep` on Linux. --- Userland/Utilities/pgrep.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Userland/Utilities/pgrep.cpp b/Userland/Utilities/pgrep.cpp index 2614ef977d..24e2fd88a3 100644 --- a/Userland/Utilities/pgrep.cpp +++ b/Userland/Utilities/pgrep.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2021, Aziz Berkay Yesilyurt + * Copyright (c) 2023, Tim Ledbetter * * SPDX-License-Identifier: BSD-2-Clause */ @@ -65,5 +66,5 @@ ErrorOr serenity_main(Main::Arguments args) if (displayed_at_least_one) outln(); - return 0; + return matches.size() > 0 ? 0 : 1; }