Skip to content

Commit

Permalink
tail/error: Fix handling of TailError on windows when no path is avai…
Browse files Browse the repository at this point in the history
…lable
  • Loading branch information
Joining7943 committed Apr 9, 2023
1 parent 6328da7 commit 291660c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/uu/tail/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ impl TailErrorHandler {
false,
)?;
}
TailError::Stat(_) | TailError::Read(_) => {
TailError::Stat(_) | TailError::Read(_) if self.input.path().is_some() => {
// unwrap is safe here because only TailError::Open doesn't produce a File
let file = file.unwrap();
match file.metadata() {
Expand All @@ -189,6 +189,11 @@ impl TailErrorHandler {
}
}
}
// FIXME: We're here on windows if the input was stdin, because we don't have a path on
// windows for stdin. Currently, the follow module depends on having a path for all
// inputs. This should be fixed. For now, we print the error message but don't follow
// the input and effectively do nothing.
TailError::Stat(_) | TailError::Read(_) => {}
}

Ok(())
Expand Down

0 comments on commit 291660c

Please sign in to comment.