From 40d04a076c84e7a59398e288ca70fa379c097a10 Mon Sep 17 00:00:00 2001 From: Aanand Prasad Date: Mon, 20 Jan 2014 19:22:05 +0000 Subject: [PATCH 1/2] Fix lag when using cursor keys in an interactive 'fig run' --- fig/cli/socketclient.py | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/fig/cli/socketclient.py b/fig/cli/socketclient.py index 842c9c6a4..99333af8c 100644 --- a/fig/cli/socketclient.py +++ b/fig/cli/socketclient.py @@ -91,22 +91,19 @@ class SocketClient: def send(self, socket, stream): while True: - r, w, e = select([stream.fileno()], [], []) + chunk = stream.read(1) - if r: - chunk = stream.read(1) - - if chunk == '': - socket.close() - break - else: - try: - socket.send(chunk) - except Exception as e: - if hasattr(e, 'errno') and e.errno == errno.EPIPE: - break - else: - raise e + if chunk == '': + socket.close() + break + else: + try: + socket.send(chunk) + except Exception as e: + if hasattr(e, 'errno') and e.errno == errno.EPIPE: + break + else: + raise e def destroy(self): if self.settings is not None: From 977ec7c94156b08d01ff9259b6b2a262f33bba73 Mon Sep 17 00:00:00 2001 From: Aanand Prasad Date: Mon, 20 Jan 2014 19:25:28 +0000 Subject: [PATCH 2/2] Remove unused import --- fig/cli/socketclient.py | 1 - 1 file changed, 1 deletion(-) diff --git a/fig/cli/socketclient.py b/fig/cli/socketclient.py index 99333af8c..b0bb087b6 100644 --- a/fig/cli/socketclient.py +++ b/fig/cli/socketclient.py @@ -1,7 +1,6 @@ from __future__ import print_function # Adapted from https://github.com/benthor/remotty/blob/master/socketclient.py -from select import select import sys import tty import fcntl