From 1bcbf3a2d26b38d3a100782644a34d8a193309af Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Fri, 6 May 2022 15:08:52 +0200 Subject: [PATCH] monitor: properly initialize timer_start It is set in `module()` which must be called before `result` so the actual usage was fine, but it was not initialized in `__init__`. --- osbuild/monitor.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osbuild/monitor.py b/osbuild/monitor.py index c87c4a31..d4273e58 100644 --- a/osbuild/monitor.py +++ b/osbuild/monitor.py @@ -91,6 +91,11 @@ class LogMonitor(BaseMonitor): the log will get written to. If `fd` is a `TTY`, escape sequences will be used to highlight sections of the log. """ + + def __init__(self, fd: int): + super().__init__(fd) + self.timer_start = 0 + def result(self, result): duration = int(time.time() - self.timer_start) self.out.write(f"\n⏱ Duration: {duration}s\n")