From 36724c5c512f1cc935c593c861122d34e89dece9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Thu, 8 Mar 2018 16:05:44 +0100 Subject: [PATCH] Implement 'tail' on stderr feedback --- lib/tfw/components/mixins/supervisor_mixin.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/tfw/components/mixins/supervisor_mixin.py b/lib/tfw/components/mixins/supervisor_mixin.py index 7023105..e00e728 100644 --- a/lib/tfw/components/mixins/supervisor_mixin.py +++ b/lib/tfw/components/mixins/supervisor_mixin.py @@ -1,6 +1,7 @@ import xmlrpc.client from contextlib import suppress from xmlrpc.client import Fault as SupervisorFault +from os import remove from tfw.config import tfwenv @@ -16,7 +17,10 @@ class SupervisorMixin: self.supervisor.startProcess(process_name) def read_log(self, process_name): - return self.supervisor.readProcessStderrLog(process_name, 0, 0) + logs = self.supervisor.readProcessStderrLog(process_name, 0, 0) + remove(self.supervisor.getProcessInfo(process_name)['stderr_logfile']) + self.supervisor.clearProcessLogs(process_name) + return logs def restart_process(self, process_name): self.stop_process(process_name)