From 12f214e2f06a85fa9f7c9e4315e60de3f13738c8 Mon Sep 17 00:00:00 2001 From: Sahan Fernando Date: Thu, 24 Dec 2020 23:10:49 +1100 Subject: [PATCH] Userland: Make grep exit after hitting EOF on stdin --- Userland/grep.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/grep.cpp b/Userland/grep.cpp index b06e0accfb..25ab2e900c 100644 --- a/Userland/grep.cpp +++ b/Userland/grep.cpp @@ -187,7 +187,7 @@ int main(int argc, char** argv) if (!files.size() && !recursive) { auto stdin_file = Core::File::standard_input(); - for (;;) { + while (!stdin_file->eof()) { auto line = stdin_file->read_line(); bool is_binary = line.bytes().contains_slow(0);