diff --git a/tail.py b/tail.py index c9e4fc2..2821681 100644 --- a/tail.py +++ b/tail.py @@ -51,11 +51,12 @@ def follow(self, s=1): file_.seek(0,2) while True: curr_position = file_.tell() - line = file_.readline() - if not line: - file_.seek(curr_position) - else: - self.callback(line) + file_.seek(0,2) + end_position = file_.tell() + file_.seek(curr_position) + if curr_position != end_position: + for line in file_: + self.callback(line) time.sleep(s) def register_callback(self, func):