summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Ledbetter <timledbetter@gmail.com>2023-05-30 17:51:06 +0100
committerAndreas Kling <kling@serenityos.org>2023-05-31 06:04:48 +0200
commit8706c88370c417a94fcfefd47b21fbe92b5a4ed4 (patch)
tree1040124df952d28481c7e3be4a23057e74f80fd6
parentcd08870a645800133f61fe4b220106211c40ae99 (diff)
downloadserenity-8706c88370c417a94fcfefd47b21fbe92b5a4ed4.zip
pgrep: Return 1 rather than 0 if there are no matches
This matches the behavior of `pgrep` on Linux.
-rw-r--r--Userland/Utilities/pgrep.cpp3
1 files changed, 2 insertions, 1 deletions
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 <abyesilyurt@gmail.com>
+ * Copyright (c) 2023, Tim Ledbetter <timledbetter@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@@ -65,5 +66,5 @@ ErrorOr<int> serenity_main(Main::Arguments args)
if (displayed_at_least_one)
outln();
- return 0;
+ return matches.size() > 0 ? 0 : 1;
}