From 7186fc8968cc3b47a1a810e346f81acb0a46b851 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20V=C3=A9zina?= <5130500+morpheus65535@users.noreply.github.com> Date: Tue, 16 Oct 2018 20:26:44 -0400 Subject: [PATCH] Prevent spawning of new instance of CherryPy before the first one has stopped. --- bazarr/main.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/bazarr/main.py b/bazarr/main.py index 1beb39963..e6be41237 100644 --- a/bazarr/main.py +++ b/bazarr/main.py @@ -210,13 +210,17 @@ def shutdown(): @route(base_url + 'restart') def restart(): try: - restart_file = open(os.path.join(os.path.dirname(os.path.dirname(__file__)), "bazarr.restart"), "w") - except Exception as e: - logging.error('Cannot create bazarr.restart file.') - else: - restart_file.write('') - restart_file.close() server.stop() + except: + logging.error('Cannot stop CherryPy.') + else: + try: + restart_file = open(os.path.join(os.path.dirname(os.path.dirname(__file__)), "bazarr.restart"), "w") + except Exception as e: + logging.error('Cannot create bazarr.restart file.') + else: + restart_file.write('') + restart_file.close() @route(base_url + 'static/:path#.+#', name='static')