parent
dec6842370
commit
bf4d6a5707
@ -598,9 +598,9 @@ class Application(QApplication):
|
||||
log.destroy.debug("sys.path: {}".format(sys.path))
|
||||
log.destroy.debug("sys.argv: {}".format(sys.argv))
|
||||
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
|
||||
try:
|
||||
args, cwd = self._get_restart_args(pages)
|
||||
if cwd is None:
|
||||
subprocess.Popen(args)
|
||||
else:
|
||||
|
@ -152,11 +152,11 @@ class IPCServer(QObject):
|
||||
return
|
||||
try:
|
||||
args = json_data['args']
|
||||
cwd = json_data['cwd']
|
||||
except KeyError:
|
||||
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
|
||||
cwd = json_data.get('cwd', None)
|
||||
app = objreg.get('app')
|
||||
app.process_args(args, via_ipc=True, cwd=cwd)
|
||||
|
||||
@ -211,7 +211,13 @@ def send_to_running_instance(cmdlist):
|
||||
connected = socket.waitForConnected(100)
|
||||
if connected:
|
||||
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'
|
||||
data = line.encode('utf-8')
|
||||
log.ipc.debug("Writing: {}".format(data))
|
||||
|
@ -136,9 +136,12 @@ def fuzzy_url(urlstr, cwd=None):
|
||||
if cwd:
|
||||
path = os.path.join(cwd, os.path.expanduser(urlstr))
|
||||
else:
|
||||
path = os.path.abspath(os.path.expanduser(urlstr))
|
||||
try:
|
||||
path = os.path.abspath(os.path.expanduser(urlstr))
|
||||
except OSError:
|
||||
path = None
|
||||
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")
|
||||
url = QUrl.fromLocalFile(path)
|
||||
elif is_url(stripped):
|
||||
|
@ -64,7 +64,7 @@ def _git_str():
|
||||
try:
|
||||
gitpath = os.path.join(os.path.dirname(os.path.realpath(__file__)),
|
||||
os.path.pardir, os.path.pardir)
|
||||
except NameError:
|
||||
except (NameError, OSError):
|
||||
log.misc.exception("Error while getting git path")
|
||||
else:
|
||||
commit = _git_str_subprocess(gitpath)
|
||||
|
Loading…
Reference in New Issue
Block a user