From 21328899404366331d8c47bc7fc1bfcb325125d1 Mon Sep 17 00:00:00 2001 From: Mariano Casco Date: Mon, 30 May 2016 13:28:50 -0300 Subject: [PATCH] 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). --- src/tail/tail.rs | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/tail/tail.rs b/src/tail/tail.rs index c22177498..41c4cac72 100755 --- a/src/tail/tail.rs +++ b/src/tail/tail.rs @@ -357,14 +357,6 @@ fn backwards_thru_file(file: &mut File, size: u64, buf: &mut Vec, 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(mut reader: BufReader, settings: &Settings) {