From 5a85449b238ab348f82db14fbcaf7460ee7ff8e8 Mon Sep 17 00:00:00 2001 From: Karol Kosek Date: Thu, 14 Sep 2023 18:45:00 +0200 Subject: [PATCH] grep: Don't end the program early after failing to grep a file We should still try to read remaining files. --- Userland/Utilities/grep.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Userland/Utilities/grep.cpp b/Userland/Utilities/grep.cpp index 537a70d2e3d..c4e1eabadc3 100644 --- a/Userland/Utilities/grep.cpp +++ b/Userland/Utilities/grep.cpp @@ -281,10 +281,8 @@ ErrorOr serenity_main(Main::Arguments args) bool print_filename { files.size() > 1 }; for (auto& filename : files) { auto result = handle_file(filename, print_filename); - if (result.is_error()) { - if (!suppress_errors) - warnln("Failed with file {}: {}", filename, result.release_error()); - return 1; + if (result.is_error() && !suppress_errors) { + warnln("Failed with file {}: {}", filename, result.release_error()); } } }