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

cat: cat_path does not need to parse InputType for stdin itself

This type is already handled by get_input_type, so we can unify the handling
This commit is contained in:
Michael Lohmann 2022-02-01 22:02:20 +01:00 committed by Michael Lohmann
parent 34b18351e2
commit 4676924532

View file

@ -325,15 +325,15 @@ fn cat_path(
state: &mut OutputState,
out_info: Option<&FileInformation>,
) -> CatResult<()> {
if path == "-" {
let stdin = io::stdin();
let mut handle = InputHandle {
reader: stdin,
is_interactive: atty::is(atty::Stream::Stdin),
};
return cat_handle(&mut handle, options, state);
}
match get_input_type(path)? {
InputType::StdIn => {
let stdin = io::stdin();
let mut handle = InputHandle {
reader: stdin,
is_interactive: atty::is(atty::Stream::Stdin),
};
cat_handle(&mut handle, options, state)
}
InputType::Directory => Err(CatError::IsDirectory),
#[cfg(unix)]
InputType::Socket => {