Commit 6b7d7b02 authored by Leo Iannacone's avatar Leo Iannacone

smarter and more efficient way to get last line in piuparts

parent 3a282105
...@@ -204,7 +204,14 @@ class LogParser(): ...@@ -204,7 +204,14 @@ class LogParser():
def parse_piuparts(self): def parse_piuparts(self):
with open(self.file, 'r') as fd: with open(self.file, 'r') as fd:
last_line = fd.readlines()[-1] offs = -1024
while True:
fd.seek(offs, 2)
lines = fd.readlines()
if len(lines) > 1:
last_line = lines[-1]
break
offs *= 2
if last_line.find('ERROR:') >= 0: if last_line.find('ERROR:') >= 0:
return 'E' return 'E'
return None return None
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment