diff --git a/SABnzbd.py b/SABnzbd.py index 1d7d9fb..6919dd4 100755 --- a/SABnzbd.py +++ b/SABnzbd.py @@ -1580,24 +1580,17 @@ def main(): sys.argv = sabnzbd.RESTART_ARGS os.chdir(org_dir) - if sabnzbd.DARWIN: - # When executing from sources on osx, after a restart, process is detached from console - # If OSX frozen restart of app instead of embedded python - if getattr(sys, 'frozen', None) == 'macosx_app': - # [[NSProcessInfo processInfo] processIdentifier]] - # logging.info("%s" % (NSProcessInfo.processInfo().processIdentifier())) - my_pid = os.getpid() - my_name = sabnzbd.MY_FULLNAME.replace('/Contents/MacOS/SABnzbd', '') - my_args = ' '.join(sys.argv[1:]) - cmd = 'kill -9 %s && open "%s" --args %s' % (my_pid, my_name, my_args) - logging.info('Launching: ', cmd) - os.system(cmd) - else: - args = sys.argv[:] - args.insert(0, sys.executable) - pid = os.fork() - if pid == 0: - os.execv(sys.executable, args) + # If OSX frozen restart of app instead of embedded python + if getattr(sys, 'frozen', None) == 'macosx_app': + # [[NSProcessInfo processInfo] processIdentifier]] + # logging.info("%s" % (NSProcessInfo.processInfo().processIdentifier())) + my_pid = os.getpid() + my_name = sabnzbd.MY_FULLNAME.replace('/Contents/MacOS/SABnzbd', '') + my_args = ' '.join(sys.argv[1:]) + cmd = 'kill -9 %s && open "%s" --args %s' % (my_pid, my_name, my_args) + logging.info('Launching: ', cmd) + os.system(cmd) + elif sabnzbd.WIN_SERVICE and mail: logging.info('Asking the SABHelper service for a restart') mail.send('restart') diff --git a/sabnzbd/__init__.py b/sabnzbd/__init__.py index b5d794e..dea1c6e 100644 --- a/sabnzbd/__init__.py +++ b/sabnzbd/__init__.py @@ -470,7 +470,7 @@ def trigger_restart(): del_connection_info() # Leave the harder restarts to the polling in SABnzbd.py - if sabnzbd.WIN_SERVICE or sabnzbd.DARWIN: + if sabnzbd.WIN_SERVICE or getattr(sys, 'frozen', None) == 'macosx_app': sabnzbd.TRIGGER_RESTART = True else: # Do the restart right now