From b64071041bc680e78b9c2725b98b69c8c9c77387 Mon Sep 17 00:00:00 2001 From: David Date: Fri, 15 Jun 2018 14:21:36 +0200 Subject: [PATCH 1/4] Raise an error if the file is erased while following --- src/tailer/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/tailer/__init__.py b/src/tailer/__init__.py index 1f8c1e1..589c7e6 100644 --- a/src/tailer/__init__.py +++ b/src/tailer/__init__.py @@ -159,6 +159,10 @@ def follow(self, delay=1.0): trailing = True while 1: + + if not os.path.exists(os.path.realpath(self.file.name)): #Check if the file still exists + raise IOError + where = self.file.tell() line = self.file.readline() if line: From 4e265b9863957b8423682e4ff5951e8da759b594 Mon Sep 17 00:00:00 2001 From: Davd96 Date: Tue, 26 Jun 2018 12:39:31 +0200 Subject: [PATCH 2/4] missed import --- src/tailer/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tailer/__init__.py b/src/tailer/__init__.py index 589c7e6..3dbd96e 100644 --- a/src/tailer/__init__.py +++ b/src/tailer/__init__.py @@ -1,6 +1,7 @@ import re import sys import time +import os.path if sys.version_info < (3,): range = xrange From fc5c0149e09ea96325918c92e80ba43eda8e0934 Mon Sep 17 00:00:00 2001 From: Davd96 Date: Tue, 26 Jun 2018 13:00:51 +0200 Subject: [PATCH 3/4] refactor tabs and spaces --- src/tailer/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tailer/__init__.py b/src/tailer/__init__.py index 3dbd96e..f193f76 100644 --- a/src/tailer/__init__.py +++ b/src/tailer/__init__.py @@ -160,9 +160,9 @@ def follow(self, delay=1.0): trailing = True while 1: - - if not os.path.exists(os.path.realpath(self.file.name)): #Check if the file still exists - raise IOError + + if not os.path.exists(os.path.realpath(self.file.name)): #Check if the file still exists + raise IOError where = self.file.tell() line = self.file.readline() From 4cf0013fa6c36600daa7b3d943777f08df47fe52 Mon Sep 17 00:00:00 2001 From: Davd96 Date: Tue, 26 Jun 2018 13:05:07 +0200 Subject: [PATCH 4/4] Refactor spaces and tabs. --- src/tailer/__init__.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/tailer/__init__.py b/src/tailer/__init__.py index f193f76..1b2d1d5 100644 --- a/src/tailer/__init__.py +++ b/src/tailer/__init__.py @@ -160,10 +160,8 @@ def follow(self, delay=1.0): trailing = True while 1: - if not os.path.exists(os.path.realpath(self.file.name)): #Check if the file still exists - raise IOError - + raise IOError where = self.file.tell() line = self.file.readline() if line: