Fix for infinite process generation on restart

This commit is contained in:
Ozzie Isaacs 2023-02-18 13:58:22 +01:00
parent 89bc72958e
commit fa3fe47059

View File

@ -152,7 +152,7 @@ class WebServer(object):
# The value of __package__ indicates how Python was called. It may # The value of __package__ indicates how Python was called. It may
# not exist if a setuptools script is installed as an egg. It may be # not exist if a setuptools script is installed as an egg. It may be
# set incorrectly for entry points created with pip on Windows. # set incorrectly for entry points created with pip on Windows.
if getattr(__main__, "__package__", None) is None or ( if getattr(__main__, "__package__", "") == "" or (
os.name == "nt" os.name == "nt"
and __main__.__package__ == "" and __main__.__package__ == ""
and not os.path.exists(py_script) and not os.path.exists(py_script)
@ -262,7 +262,10 @@ class WebServer(object):
log.info("Performing restart of Calibre-Web") log.info("Performing restart of Calibre-Web")
args = self._get_args_for_reloading() args = self._get_args_for_reloading()
subprocess.call(args, close_fds=True) # nosec if os.environ.get('FLASK_DEBUG'):
subprocess.run(args, close_fds=True) # nosec
else:
subprocess.Popen(args, close_fds=True) # nosec
return True return True
@staticmethod @staticmethod