From 38c601bb10f14e549bbd88ab0c46b9865756ce91 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Sun, 19 Feb 2023 09:10:25 +0100 Subject: [PATCH] Bugfix server restart to prevent infinite calibre-web instances --- cps/server.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cps/server.py b/cps/server.py index 1a25a72e..15a1ef7b 100644 --- a/cps/server.py +++ b/cps/server.py @@ -194,6 +194,8 @@ class WebServer(object): rv.extend(("-m", py_module.lstrip("."))) rv.extend(args) + if os.name == 'nt': + rv = ['"{}"'.format(a) for a in rv] return rv def _start_gevent(self): @@ -263,10 +265,7 @@ class WebServer(object): log.info("Performing restart of Calibre-Web") args = self._get_args_for_reloading() - if os.environ.get('FLASK_DEBUG'): - subprocess.run(args, close_fds=True) # nosec - else: - subprocess.run(args, close_fds=True) # nosec + os.execv(args[0].lstrip('"').rstrip('"'), args) return True @staticmethod