1
0
mirror of https://github.com/Mailu/Mailu.git synced 2025-08-10 22:31:47 +02:00

Flush buffer on flush() and flush explicitely after subprocess has ended

(cherry picked from commit f16467b984)
This commit is contained in:
Alexander Graf
2024-10-17 16:59:55 +02:00
committed by Mergify
parent a910f4caac
commit 9dae649f31

View File

@@ -50,10 +50,11 @@ class LogFilter(object):
self.stream.flush() self.stream.flush()
self.buffer = rest self.buffer = rest
def close(self): def flush(self):
# write out buffer on flush even if it's not a complete line
if self.buffer and not self.pattern.search(self.buffer): if self.buffer and not self.pattern.search(self.buffer):
self.stream.buffer.write(self.buffer) self.stream.buffer.write(self.buffer)
self.stream.close() self.stream.flush()
def _is_compatible_with_hardened_malloc(): def _is_compatible_with_hardened_malloc():
with open('/proc/cpuinfo', 'r') as f: with open('/proc/cpuinfo', 'r') as f:
@@ -168,4 +169,7 @@ def run_process_and_forward_output(cmd):
stderr_thread.daemon = True stderr_thread.daemon = True
stderr_thread.start() stderr_thread.start()
return process.wait() rc = process.wait()
sys.stdout.flush()
sys.stderr.flush()
return rc