From f6a9048a56400b7bed927ee29d78a6a3e50eaba5 Mon Sep 17 00:00:00 2001 From: Raphael Roberts Date: Fri, 29 Nov 2019 13:35:35 -0600 Subject: [PATCH] Guaranteed to run cleanup functions in error conditions --- ctabus/internal/notification.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ctabus/internal/notification.py b/ctabus/internal/notification.py index 058021b..70a8617 100755 --- a/ctabus/internal/notification.py +++ b/ctabus/internal/notification.py @@ -1,4 +1,5 @@ from concurrent.futures import ThreadPoolExecutor +import atexit import os import shlex import shutil @@ -30,6 +31,7 @@ class NotificationManager: self._posting = False self._poster = None self._live = True + atexit.register(self._cleanup) def on_done(self): pass