parent
dec6842370
commit
bf4d6a5707
@ -598,9 +598,9 @@ class Application(QApplication):
|
|||||||
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')))
|
||||||
args, cwd = self._get_restart_args(pages)
|
|
||||||
# Open a new process and immediately shutdown the existing one
|
# Open a new process and immediately shutdown the existing one
|
||||||
try:
|
try:
|
||||||
|
args, cwd = self._get_restart_args(pages)
|
||||||
if cwd is None:
|
if cwd is None:
|
||||||
subprocess.Popen(args)
|
subprocess.Popen(args)
|
||||||
else:
|
else:
|
||||||
|
@ -152,11 +152,11 @@ class IPCServer(QObject):
|
|||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
args = json_data['args']
|
args = json_data['args']
|
||||||
cwd = json_data['cwd']
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
log.ipc.error("Ignoring invalid IPC data.")
|
log.ipc.error("Ignoring invalid IPC data.")
|
||||||
log.ipc.debug("no args/cwd: {}".format(decoded.strip()))
|
log.ipc.debug("no args: {}".format(decoded.strip()))
|
||||||
return
|
return
|
||||||
|
cwd = json_data.get('cwd', None)
|
||||||
app = objreg.get('app')
|
app = objreg.get('app')
|
||||||
app.process_args(args, via_ipc=True, cwd=cwd)
|
app.process_args(args, via_ipc=True, cwd=cwd)
|
||||||
|
|
||||||
@ -211,7 +211,13 @@ def send_to_running_instance(cmdlist):
|
|||||||
connected = socket.waitForConnected(100)
|
connected = socket.waitForConnected(100)
|
||||||
if connected:
|
if connected:
|
||||||
log.ipc.info("Opening in existing instance")
|
log.ipc.info("Opening in existing instance")
|
||||||
json_data = {'args': cmdlist, 'cwd': os.getcwd()}
|
json_data = {'args': cmdlist}
|
||||||
|
try:
|
||||||
|
cwd = os.getcwd()
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
json_data['cwd'] = cwd
|
||||||
line = json.dumps(json_data) + '\n'
|
line = json.dumps(json_data) + '\n'
|
||||||
data = line.encode('utf-8')
|
data = line.encode('utf-8')
|
||||||
log.ipc.debug("Writing: {}".format(data))
|
log.ipc.debug("Writing: {}".format(data))
|
||||||
|
@ -136,9 +136,12 @@ def fuzzy_url(urlstr, cwd=None):
|
|||||||
if cwd:
|
if cwd:
|
||||||
path = os.path.join(cwd, os.path.expanduser(urlstr))
|
path = os.path.join(cwd, os.path.expanduser(urlstr))
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
path = os.path.abspath(os.path.expanduser(urlstr))
|
path = os.path.abspath(os.path.expanduser(urlstr))
|
||||||
|
except OSError:
|
||||||
|
path = None
|
||||||
stripped = urlstr.strip()
|
stripped = urlstr.strip()
|
||||||
if os.path.exists(path):
|
if path is not None and os.path.exists(path):
|
||||||
log.url.debug("URL is a local file")
|
log.url.debug("URL is a local file")
|
||||||
url = QUrl.fromLocalFile(path)
|
url = QUrl.fromLocalFile(path)
|
||||||
elif is_url(stripped):
|
elif is_url(stripped):
|
||||||
|
@ -64,7 +64,7 @@ def _git_str():
|
|||||||
try:
|
try:
|
||||||
gitpath = os.path.join(os.path.dirname(os.path.realpath(__file__)),
|
gitpath = os.path.join(os.path.dirname(os.path.realpath(__file__)),
|
||||||
os.path.pardir, os.path.pardir)
|
os.path.pardir, os.path.pardir)
|
||||||
except NameError:
|
except (NameError, OSError):
|
||||||
log.misc.exception("Error while getting git path")
|
log.misc.exception("Error while getting git path")
|
||||||
else:
|
else:
|
||||||
commit = _git_str_subprocess(gitpath)
|
commit = _git_str_subprocess(gitpath)
|
||||||
|
Loading…
Reference in New Issue
Block a user