Repository navigation
Conversation
|
GNU diffutils testsuite comparison: |
| diff = "0.1.13" | ||
| itoa = "1.0.11" | ||
| regex = "1.10.4" | ||
| rustix = { version = "1.1.4", features = ["fs"] } |
There was a problem hiding this comment.
do we really need a new dependency to save one stat() call?
please justify it, or use std (as_fd().try_clone_to_owned() + MetadataExt::rdev())
There was a problem hiding this comment.
try_clone needs additional fcntl call.
|
|
||
| #[cfg(any(target_os = "linux", target_os = "android"))] | ||
| fn is_stdout_dev_null() -> bool { | ||
| // as_fd().try_clone_to_owned() needs additional overhead of fcntl |
There was a problem hiding this comment.
the unix version below doesn't need fcntl either (from_raw_fd + forget)
could you please do the same with MetadataExt::rdev() + FileTypeExt::is_char_device() and drop rustix?
There was a problem hiding this comment.
Is needs unsafe. Is it OK? clap-rs already pulls rustix.
There was a problem hiding this comment.
I think std does not have a feature to check major/minor.
|
The only thing left is whether rustix is needed at all. std can do the same without fcntl, the way the existing unix path already does. |
|
Other unix has 2nd open call at |
|
It seems possible, but some magic numbers and bit shift is needed to avoid |
Don't reopen 2nd
/dev/nullatfn is_stdout_dev_nullon Linux.