Skip to content

Commit

Permalink
Fixed bazarr restart traceback exception
Browse files Browse the repository at this point in the history
  • Loading branch information
anderson-oki authored May 31, 2024
1 parent 8842004 commit b7e6de7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bazarr/utilities/central.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# only methods can be specified here that do not cause other moudules to be loaded
# for other methods that use settings, etc., use utilities/helper.py

import contextlib
import logging
import os
from pathlib import Path
Expand Down Expand Up @@ -53,4 +54,8 @@ def restart_bazarr():
except Exception as e:
logging.error(f'BAZARR Cannot create restart file: {repr(e)}')
logging.info('Bazarr is being restarted...')
raise SystemExit(EXIT_NORMAL)

# Wrap the SystemExit for a graceful restart. The SystemExit still performs the cleanup but the traceback is omitted
# preventing to throw the exception to the caller but still terminates the Python process with the desired Exit Code
with contextlib.suppress(SystemExit):
raise SystemExit(EXIT_NORMAL)

0 comments on commit b7e6de7

Please sign in to comment.