1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-30 12:37:49 +00:00

tail: don't follow() as part of bounded_tail

To get the -f option to follow multiple files, bounded_tail should just
tail a single file and return, instead of blocking processing of other
files by calling follow() (which loops forever).
This commit is contained in:
Mariano Casco 2016-05-30 13:28:50 -03:00
parent 6a4efdc842
commit 2132889940

View file

@ -357,14 +357,6 @@ fn backwards_thru_file<F>(file: &mut File, size: u64, buf: &mut Vec<u8>, delimit
/// being a nice performance win for very large files.
fn bounded_tail(mut file: File, settings: &Settings) {
let size = file.seek(SeekFrom::End(0)).unwrap();
if size == 0 {
if settings.follow {
let reader = BufReader::new(file);
follow(reader, settings);
}
return;
}
let mut buf = vec![0; BLOCK_SIZE as usize];
// Find the position in the file to start printing from.
@ -397,12 +389,6 @@ fn bounded_tail(mut file: File, settings: &Settings) {
break;
}
}
// Continue following changes, if requested.
if settings.follow {
let reader = BufReader::new(file);
follow(reader, settings);
}
}
fn unbounded_tail<T: Read>(mut reader: BufReader<T>, settings: &Settings) {