From c979597ec472e3812421804dc3068669df2b64a7 Mon Sep 17 00:00:00 2001 From: Paul Donald Date: Sat, 11 May 2024 07:59:05 +0200 Subject: [PATCH] Prevent shutdown fault-log trace-back (#116735) Closes issue #116710 --- homeassistant/__main__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/homeassistant/__main__.py b/homeassistant/__main__.py index 0c0d535753cd..4c870e94b24e 100644 --- a/homeassistant/__main__.py +++ b/homeassistant/__main__.py @@ -3,6 +3,7 @@ from __future__ import annotations import argparse +from contextlib import suppress import faulthandler import os import sys @@ -208,8 +209,10 @@ def main() -> int: exit_code = runner.run(runtime_conf) faulthandler.disable() - if os.path.getsize(fault_file_name) == 0: - os.remove(fault_file_name) + # It's possible for the fault file to disappear, so suppress obvious errors + with suppress(FileNotFoundError): + if os.path.getsize(fault_file_name) == 0: + os.remove(fault_file_name) check_threads()