Make restart work when frozen
This commit is contained in:
parent
65353773d1
commit
f3f04b6f21
@ -591,23 +591,27 @@ class Application(QApplication):
|
|||||||
urlstr = tab.url().toString()
|
urlstr = tab.url().toString()
|
||||||
if urlstr:
|
if urlstr:
|
||||||
pages.append(urlstr)
|
pages.append(urlstr)
|
||||||
path = os.path.join(os.path.abspath(os.path.dirname(
|
|
||||||
qutebrowser.__file__)), '..')
|
|
||||||
log.destroy.debug("path: {}".format(path))
|
|
||||||
log.destroy.debug("sys.executable: {}".format(sys.executable))
|
log.destroy.debug("sys.executable: {}".format(sys.executable))
|
||||||
log.destroy.debug("sys.path: {}".format(sys.path))
|
log.destroy.debug("sys.path: {}".format(sys.path))
|
||||||
log.destroy.debug("sys.argv: {}".format(sys.argv))
|
log.destroy.debug("sys.argv: {}".format(sys.argv))
|
||||||
log.destroy.debug("frozen: {}".format(hasattr(sys, 'frozen')))
|
log.destroy.debug("frozen: {}".format(hasattr(sys, 'frozen')))
|
||||||
|
if hasattr(sys, 'frozen'):
|
||||||
|
args = [sys.executable]
|
||||||
|
cwd = os.path.abspath(os.path.dirname(sys.executable))
|
||||||
|
else:
|
||||||
args = [sys.executable, '-m', 'qutebrowser']
|
args = [sys.executable, '-m', 'qutebrowser']
|
||||||
|
cwd = os.path.join(os.path.abspath(os.path.dirname(
|
||||||
|
qutebrowser.__file__)), '..')
|
||||||
for arg in sys.argv[1:]:
|
for arg in sys.argv[1:]:
|
||||||
if arg.startswith('-'):
|
if arg.startswith('-'):
|
||||||
# We only want to preserve options on a restart.
|
# We only want to preserve options on a restart.
|
||||||
args.append(arg)
|
args.append(arg)
|
||||||
# Add all open pages so they get reopened.
|
# Add all open pages so they get reopened.
|
||||||
args += pages
|
args += pages
|
||||||
log.destroy.debug("final args: {}".format(args))
|
log.destroy.debug("args: {}".format(args))
|
||||||
|
log.destroy.debug("cwd: {}".format(cwd))
|
||||||
# Open a new process and immediately shutdown the existing one
|
# Open a new process and immediately shutdown the existing one
|
||||||
subprocess.Popen(args, cwd=path)
|
subprocess.Popen(args, cwd=cwd)
|
||||||
if shutdown:
|
if shutdown:
|
||||||
self.shutdown()
|
self.shutdown()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user