Fix lag when using cursor keys in an interactive 'fig run'

This commit is contained in:
Aanand Prasad 2014-01-20 19:22:05 +00:00
parent 4646ac85b0
commit 40d04a076c

View File

@ -91,22 +91,19 @@ class SocketClient:
def send(self, socket, stream): def send(self, socket, stream):
while True: while True:
r, w, e = select([stream.fileno()], [], []) chunk = stream.read(1)
if r: if chunk == '':
chunk = stream.read(1) socket.close()
break
if chunk == '': else:
socket.close() try:
break socket.send(chunk)
else: except Exception as e:
try: if hasattr(e, 'errno') and e.errno == errno.EPIPE:
socket.send(chunk) break
except Exception as e: else:
if hasattr(e, 'errno') and e.errno == errno.EPIPE: raise e
break
else:
raise e
def destroy(self): def destroy(self):
if self.settings is not None: if self.settings is not None: