From 81f81a6c2427e4e820f7c949bac1def1f986e98e Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sun, 22 Aug 2021 19:50:04 -0700 Subject: [PATCH] Don't log exit status if --operatornotify/level wasn't passed. --- voussoirkit/operatornotify.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/voussoirkit/operatornotify.py b/voussoirkit/operatornotify.py index 07efb70..194d428 100644 --- a/voussoirkit/operatornotify.py +++ b/voussoirkit/operatornotify.py @@ -178,6 +178,10 @@ def main_decorator(subject, *args, **kwargs): def wrapper(main): def wrapped(argv): (context, argv) = main_log_context(argv, subject, *args, **kwargs) + + if isinstance(context, contextlib.nullcontext): + return main(argv) + with context: status = main(argv) log.info('Program finished, returned %s.', status)