Remote Live logs after '\n' and not on buffer_size
We have:
channel.exec_command(command)
while True:
current_time = now()
if channel.recv_ready():
output = channel.recv(1024).decode('utf-8')
stdout_handler(current_time, output)
if channel.recv_stderr_ready():
output = channel.recv_stderr(1024).decode('utf-8')
stderr_handler(current_time, output)
i.e., logs are flushed after 1024 bytes. Can we flush them after \n
?
See paramiko-expect
tail function:
buffer = self.channel.recv(1)
and search for \n
.
Is it going to be too slow?