[elbe-devel] [PATCH 1/4] elbepack: log: always properly close async logging

Thomas Weißschuh thomas.weissschuh at linutronix.de
Fri Apr 26 16:25:36 CEST 2024


In case of an exception the logging t.join() called would have been
skipped.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/log.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/elbepack/log.py b/elbepack/log.py
index 7ea9ad0cd04a..a76ee53b0518 100644
--- a/elbepack/log.py
+++ b/elbepack/log.py
@@ -292,5 +292,7 @@ def async_logging(r, w, stream, block, atmost=4096):
 @contextmanager
 def async_logging_ctx(*args, **kwargs):
     t = async_logging(*args, **kwargs)
-    yield
-    t.join()
+    try:
+        yield
+    finally:
+        t.join()

-- 
2.44.0



More information about the elbe-devel mailing list