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