1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

wc: Stricter simpler error handling

Errors are now always shown with the corresponding filename.

Errors are no longer converted into warnings. Previously `wc < .`
would cause a loop.

Checking whether something is a directory is no longer done in
advance. This removes race conditions and the edge case where stdin is
a directory.

The custom error type is removed because io::Error is now enough.
This commit is contained in:
Jan Verbeek 2021-08-25 14:26:03 +02:00 committed by Michael Debertol
parent 35793fc260
commit 657a04f706
5 changed files with 26 additions and 47 deletions

View file

@ -212,7 +212,7 @@ fn test_read_from_directory_error() {
new_ucmd!()
.args(&["."])
.fails()
.stderr_contains(".: Is a directory\n")
.stderr_contains(".: Is a directory")
.stdout_is("0 0 0 .\n");
}
@ -222,5 +222,5 @@ fn test_read_from_nonexistent_file() {
new_ucmd!()
.args(&["bogusfile"])
.fails()
.stderr_contains("bogusfile: No such file or directory\n");
.stderr_contains("bogusfile: No such file or directory");
}