From ed52038bc49d484fbd8f828d6c8008a5fdb52a8a Mon Sep 17 00:00:00 2001 From: Jack Wilsdon Date: Fri, 22 Jan 2016 13:17:16 +0000 Subject: [PATCH] Use os.execv instead of subprocess.Popen to restart the process This fixes #460. --- plexpy/__init__.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/plexpy/__init__.py b/plexpy/__init__.py index 61f55ca7..744d2d22 100644 --- a/plexpy/__init__.py +++ b/plexpy/__init__.py @@ -812,12 +812,13 @@ def shutdown(restart=False, update=False): if restart: logger.info('PlexPy is restarting...') - popen_list = [sys.executable, FULL_PATH] - popen_list += ARGS - if '--nolaunch' not in popen_list: - popen_list += ['--nolaunch'] - logger.info('Restarting PlexPy with %s', popen_list) - subprocess.Popen(popen_list, cwd=os.getcwd()) + exe = sys.executable + args = [exe, FULL_PATH] + args += ARGS + if '--nolaunch' not in args: + args += ['--nolaunch'] + logger.info('Restarting PlexPy with %s', args) + os.execv(exe, args) os._exit(0)