mirror of
https://github.com/Snigdha-OS/snigdhaos-blackbox.git
synced 2025-09-21 03:55:05 +02:00
add #add_pacmanlog_queue function
This commit is contained in:

committed by
GitHub

parent
4b8ceb7a8d
commit
8268cfd375
@@ -1267,3 +1267,20 @@ def cache(package, path_dir_cache):
|
||||
|
||||
except Exception as e:
|
||||
logger.error("Exception in cache(): %s " % e)
|
||||
|
||||
def add_pacmanlog_queue(self):
|
||||
try:
|
||||
lines = []
|
||||
with open(pacman_logfile, "r", encoding="utf-8") as f:
|
||||
while True:
|
||||
line = f.readline()
|
||||
if line:
|
||||
lines.append(line.encode("utf-8"))
|
||||
self.pacmanlog_queue.put(lines)
|
||||
else:
|
||||
time.sleep(0.5)
|
||||
|
||||
except Exception as e:
|
||||
logger.error("Exception in add_pacmanlog_queue() : %s" % e)
|
||||
finally:
|
||||
logger.debug("No new lines found inside the pacman log file")
|
||||
|
Reference in New Issue
Block a user