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:
parent
6a4efdc842
commit
2132889940
1 changed files with 0 additions and 14 deletions
|
@ -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.
|
/// being a nice performance win for very large files.
|
||||||
fn bounded_tail(mut file: File, settings: &Settings) {
|
fn bounded_tail(mut file: File, settings: &Settings) {
|
||||||
let size = file.seek(SeekFrom::End(0)).unwrap();
|
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];
|
let mut buf = vec![0; BLOCK_SIZE as usize];
|
||||||
|
|
||||||
// Find the position in the file to start printing from.
|
// Find the position in the file to start printing from.
|
||||||
|
@ -397,12 +389,6 @@ fn bounded_tail(mut file: File, settings: &Settings) {
|
||||||
break;
|
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) {
|
fn unbounded_tail<T: Read>(mut reader: BufReader<T>, settings: &Settings) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue