mirror of https://github.com/docker/compose.git
Merge pull request #39 from orchardup/fix-cursor-lag
Fix lag when using cursor keys in an interactive 'fig run'
This commit is contained in:
commit
4ee87a7029
|
@ -1,7 +1,6 @@
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
# Adapted from https://github.com/benthor/remotty/blob/master/socketclient.py
|
# Adapted from https://github.com/benthor/remotty/blob/master/socketclient.py
|
||||||
|
|
||||||
from select import select
|
|
||||||
import sys
|
import sys
|
||||||
import tty
|
import tty
|
||||||
import fcntl
|
import fcntl
|
||||||
|
@ -91,22 +90,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:
|
||||||
|
|
Loading…
Reference in New Issue