Merged
Conversation
There was a problem hiding this comment.
PR Overview
This pull request improves error management for the head utility by providing more descriptive error messages and ensuring consistent error mapping during output operations.
- Updates the error message in the test to include context about standard output errors
- Introduces a new helper function, map_stdout_error, to wrap and format errors consistently
- Applies map_stdout_error mapping to both copy and flush operations in relevant functions
Reviewed Changes
| File | Description |
|---|---|
| tests/by-util/test_head.rs | Updates expected error message for write failures |
| src/uu/head/src/head.rs | Adds map_stdout_error function and applies it to error handling calls |
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (2)
tests/by-util/test_head.rs:809
- The updated error message now includes additional context regarding standard output errors. Verify that this message is consistent with error wording elsewhere in the application.
.stderr_contains("error writing 'standard output': No space left on device");
src/uu/head/src/head.rs:246
- [nitpick] Consider inlining map_stdout_error (e.g. with #[inline]) to potentially reduce function call overhead for this trivial error mapping function.
fn map_stdout_error(err: io::Error) -> io::Error {
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
cakebaker
reviewed
Mar 7, 2025
And provide more details than GNU Should fix tests/head/head-write-error
RenjiSann
approved these changes
Mar 7, 2025
sylvestre
added a commit
that referenced
this pull request
Mar 7, 2025
sylvestre
added a commit
to sylvestre/coreutils
that referenced
this pull request
Mar 18, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
And provide more details than GNU
Should fix tests/head/head-write-error