mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:24:57 +00:00
Utilities: Fix grep match when reading from stdin
When reading from stdin, grep discards the last character, even if that character is not \n. This commit changes grep to no longer discard the last character from a line.
This commit is contained in:
parent
eed0bcaf42
commit
68de9008e7
1 changed files with 1 additions and 1 deletions
|
@ -177,7 +177,7 @@ int main(int argc, char** argv)
|
|||
ScopeGuard free_line = [line] { free(line); };
|
||||
while ((nread = getline(&line, &line_len, stdin)) != -1) {
|
||||
VERIFY(nread > 0);
|
||||
StringView line_view(line, nread - 1);
|
||||
StringView line_view(line, nread);
|
||||
bool is_binary = line_view.contains(0);
|
||||
|
||||
if (is_binary && binary_mode == BinaryFileMode::Skip)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue