Fix change that broke restarting with calibre-debug -g

This commit is contained in:
Kovid Goyal 2014-12-15 07:37:31 +05:30
parent c5a68289ad
commit 3afe76ab30

View File

@ -348,14 +348,16 @@ def run_gui(opts, args, listener, app, gui_debug=None):
run_in_debug_mode() run_in_debug_mode()
else: else:
import subprocess import subprocess
prints('Restarting with:', e)
if hasattr(sys, 'frameworks_dir'): if hasattr(sys, 'frameworks_dir'):
app = os.path.dirname(os.path.dirname(os.path.realpath(sys.frameworks_dir))) app = os.path.dirname(os.path.dirname(os.path.realpath(sys.frameworks_dir)))
prints('Restarting with:', app)
subprocess.Popen('sleep 3s; open ' + shellquote(app), shell=True) subprocess.Popen('sleep 3s; open ' + shellquote(app), shell=True)
else: else:
if iswindows and hasattr(winutil, 'prepare_for_restart'): if iswindows and hasattr(winutil, 'prepare_for_restart'):
winutil.prepare_for_restart() winutil.prepare_for_restart()
subprocess.Popen([e]) args = ['-g'] if os.path.splitext(e)[0].endswith('-debug') else []
prints('Restarting with:', ' '.join([e] + args))
subprocess.Popen([e] + args)
else: else:
if iswindows: if iswindows:
try: try: