Commit 47dbb015 authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Fixed asyncio reader. Added -n to ssh command.

parent 7adc50e8
......@@ -75,10 +75,22 @@ class LOG:
self.decode = decode
def __call__(self, flush=False):
def __call__(self):
with self.mutex:
buf = os.read(self.fd, 4096)
self.buf.extend(buf)
while True:
buf = os.read(self.fd, 10)
i = self.buf.find(b'\n')
if i < 0: break
self.log.MESSAGE(self.decode(self.buf[0:i]),
level=level)
self.buf = self.buf[i+1:]
def flush(self):
with self.mutex:
while True:
buf = os.read(self.fd, 4096)
if len(buf) == 0: break
self.buf.extend(buf)
while True:
......@@ -87,8 +99,8 @@ class LOG:
self.log.MESSAGE(self.decode(self.buf[0:i]),
level=level)
self.buf = self.buf[i+1:]
if len(self.buf) > 0 and flush:
self.log.MESSAGE(self.decode(self.buf), level=level)
if len(self.buf) > 0:
self.log.MESSAGE(self.decode(self.buf), level=level)
class MakeFile:
def __init__(self, log):
......@@ -102,5 +114,6 @@ class LOG:
def __del__(self):
loop.remove_reader(self.rpipe)
os.close(self.wpipe)
self.reader(flush=True)
self.reader.flush()
return MakeFile(self)
......@@ -156,7 +156,7 @@ class Client:
log=self.server_log)
socket_path = '/tmp/%s_client' % (self.uuid)
cmd = (
[ 'ssh', self.entry.mount.host ] +
[ 'ssh', '-n', self.entry.mount.host ] +
( self.options.user and
[ '-l', self.options.user ] or []) +
( self.options.identity and
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment