-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
stdbuf: remove crash macro #5549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
GNU testsuite comparison:
|
Did you see that |
No, I didn't, will take a look now |
GNU testsuite comparison:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Just one suggestion
src/uu/stdbuf/src/stdbuf.rs
Outdated
@@ -102,7 +103,10 @@ fn check_option(matches: &ArgMatches, name: &str) -> Result<BufferType, ProgramO | |||
} | |||
} | |||
x => parse_size_u64(x).map_or_else( | |||
|e| crash!(125, "invalid mode {}", e), | |||
|e| { | |||
set_exit_code(125); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this lines should not be necessary. The exit code should be added to the error here:
coreutils/src/uu/stdbuf/src/stdbuf.rs
Line 151 in 26df944
let options = ProgramOptions::try_from(&matches).map_err(|e| UUsageError::new(125, e.0))?; |
It'd be great if you could also verify that this is actually the case by writing a test for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, you're right, I've taken that line out. However, the test already asserts that the error code is 125: https://github.com/cswn/coreutils/blob/26df9445fb70152abfd523c0bdb75def6c7d5475/tests/by-util/test_stdbuf.rs#L67C9-L67C9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool!
GNU testsuite comparison:
|
Thanks! |
This is related to issue: #5487
Removes the
crash!
macro fromstdbuf
.