mirror of
https://github.com/sharkdp/bat
synced 2026-08-06 19:21:43 +00:00
Pass stdin as a generic BufRead, fix stdin tests
This commit is contained in:
+2
-2
@@ -86,9 +86,9 @@ pub enum InputFile<'a> {
|
||||
}
|
||||
|
||||
impl<'a> InputFile<'a> {
|
||||
pub(crate) fn get_reader(&self, stdin: &'a io::Stdin) -> Result<InputFileReader> {
|
||||
pub(crate) fn get_reader<R: BufRead + 'a>(&self, stdin: R) -> Result<InputFileReader> {
|
||||
match self {
|
||||
InputFile::StdIn(_) => Ok(InputFileReader::new(stdin.lock())),
|
||||
InputFile::StdIn(_) => Ok(InputFileReader::new(stdin)),
|
||||
InputFile::Ordinary(ofile) => {
|
||||
let file = File::open(ofile.path)
|
||||
.map_err(|e| format!("'{}': {}", ofile.path.to_string_lossy(), e))?;
|
||||
|
||||
Reference in New Issue
Block a user