diff --git a/salt/_logging/handlers.py b/salt/_logging/handlers.py index 7b751bdcef59..85c25865f602 100644 --- a/salt/_logging/handlers.py +++ b/salt/_logging/handlers.py @@ -65,7 +65,11 @@ def flush(self): super().handle(record) finally: self.__emitting = False - super().flush() + # Seeing an exception from calling flush on a closed file in the test + # suite. Handling this condition for now but this seems to be + # indicitive of an un-clean teardown at some point. + if not self.stream.closed: + super().flush() def sync_with_handlers(self, handlers=()): """