add #add_pacmanlog_queue function

This commit is contained in:
Abhiraj Roy (iconized)
2024-04-24 17:38:35 +05:30
committed by GitHub
parent 4b8ceb7a8d
commit 8268cfd375

View File

@@ -1267,3 +1267,20 @@ def cache(package, path_dir_cache):
except Exception as e: except Exception as e:
logger.error("Exception in cache(): %s " % 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")