Error handling when writing to running instance.
This commit is contained in:
parent
451a8be748
commit
f759106a14
@ -29,6 +29,7 @@ from qutebrowser.utils import log, objreg
|
|||||||
|
|
||||||
SOCKETNAME = 'qutebrowser-{}'.format(getpass.getuser())
|
SOCKETNAME = 'qutebrowser-{}'.format(getpass.getuser())
|
||||||
CONNECT_TIMEOUT = 100
|
CONNECT_TIMEOUT = 100
|
||||||
|
WRITE_TIMEOUT = 1000
|
||||||
|
|
||||||
server = None
|
server = None
|
||||||
|
|
||||||
@ -56,7 +57,10 @@ def send_to_running_instance(cmdlist):
|
|||||||
log.init.info("Opening in existing instance")
|
log.init.info("Opening in existing instance")
|
||||||
line = json.dumps(cmdlist) + '\n'
|
line = json.dumps(cmdlist) + '\n'
|
||||||
socket.writeData(line.encode('utf-8'))
|
socket.writeData(line.encode('utf-8'))
|
||||||
socket.waitForBytesWritten()
|
socket.waitForBytesWritten(WRITE_TIMEOUT)
|
||||||
|
if socket.error():
|
||||||
|
raise IPCError("Error while writing to running instance: "
|
||||||
|
"{}".format(socket.errorString()))
|
||||||
else:
|
else:
|
||||||
if socket.error() != QLocalSocket.ConnectionRefusedError:
|
if socket.error() != QLocalSocket.ConnectionRefusedError:
|
||||||
raise IPCError("Error while connecting to running instance: "
|
raise IPCError("Error while connecting to running instance: "
|
||||||
|
Loading…
Reference in New Issue
Block a user