Refactor restart to utils.processes.restart

This commit is contained in:
Labrys of Knossos 2019-01-15 18:06:05 -05:00
commit b6672ccf09
3 changed files with 25 additions and 21 deletions

View file

@ -63,6 +63,7 @@ from core.utils import (
remove_dir,
remove_read_only,
remove_torrent,
restart,
resume_torrent,
sanitize_name,
update_download_info_status,
@ -863,23 +864,3 @@ def initialize(section=None):
# finished initalizing
return True
def restart():
install_type = version_check.CheckVersion().install_type
status = 0
popen_list = []
if install_type in ('git', 'source'):
popen_list = [sys.executable, APP_FILENAME]
if popen_list:
popen_list += SYS_ARGV
logger.log(u'Restarting nzbToMedia with {args}'.format(args=popen_list))
logger.close()
p = subprocess.Popen(popen_list, cwd=os.getcwd())
p.wait()
status = p.returncode
os._exit(status)