Repository navigation
Conversation
f38e2f5 to
39004e0
Compare
|
I think something like |
| fn err_if_stdin_closed() -> io::Result<()> { | ||
| #[cfg(feature = "signals")] | ||
| if signals::stdin_was_closed() { | ||
| return Err(io::Error::other(translate!("error-bad-file-descriptor"))); |
There was a problem hiding this comment.
rustix::io::Errno::BADF.into()
There was a problem hiding this comment.
I'd agree, but the error is not localized if I do this :(
There was a problem hiding this comment.
I was considering that OS provides translated error message corresponding with errno via glibc.
39004e0 to
6ffab91
Compare
|
Relates to: #12210. |
| } | ||
| } | ||
|
|
||
| pub fn ustdin() -> UStdin { |
There was a problem hiding this comment.
I'd probably just name this stdin, and likewise for UStdin
There was a problem hiding this comment.
why not follow the naming of other wrappers of uucore (like UResult, UError, etc...) ?
There was a problem hiding this comment.
why not follow the naming of other wrappers of uucore (like
UResult,UError, etc...) ?
I’m not particularly fond of the naming of those types either, but they’re very common return types, so disambiguation may be necessary. That doesn’t apply in this case, though.
There was a problem hiding this comment.
The name ustdin at least should be stdin.
dbdcd7e to
1776a3d
Compare
Merging this PR will improve performance by 3.41%1 warning, 1 note
Performance Changes
Tip Curious why performance improved? Comment Comparing Footnotes
|
7d4cfe4 to
a4accfa
Compare
a4accfa to
3520870
Compare
3520870 to
85ffcd4
Compare
| selinux = ["dep:selinux", "libc"] | ||
| smack = ["xattr"] | ||
| signals = ["nix/fs", "nix/signal", "nix/poll"] | ||
| stdio = [] |
There was a problem hiding this comment.
| stdio = [] | |
| stdio = ["signals"] |
we should enable the signals feature here, and not directly in the checksum feature
There was a problem hiding this comment.
Not sure about that. I made the stdio feature be usable without signals, in case we ever need to further extend the capacities of the wrapper. The idea is to be able to use ustdin() everywhere in the uutils, no matter the availability of signals
that checks for stdin closure before reading
85ffcd4 to
63ba0b3
Compare
| fs::{File, remove_file}, | ||
| io::{BufRead, BufWriter, Write}, | ||
| }; | ||
| use std::fs::{File, remove_file}; |
There was a problem hiding this comment.
Going forward, it would be better to keep unrelated style changes in a separate commit.
Also uses it in
base32and derivatives,cksumand derivatives, andcsplitrelated to #10153