2
0
mirror of https://github.com/sharkdp/bat synced 2024-11-04 18:00:24 +00:00

Only print contents if file wasn't empty, or EOF wasn't first thing received from stdin.

This commit is contained in:
Reid Wagner 2019-02-09 20:21:12 -08:00 committed by David Peter
parent 10c5f79640
commit 76b7418e35

View File

@ -80,7 +80,9 @@ impl<'b> Controller<'b> {
input_file: InputFile<'a>,
) -> Result<()> {
printer.print_header(writer, input_file)?;
self.print_file_ranges(printer, writer, reader, &self.config.line_ranges)?;
if !reader.first_line.is_empty() {
self.print_file_ranges(printer, writer, reader, &self.config.line_ranges)?;
}
printer.print_footer(writer)?;
Ok(())