From: Jonatan Schlag Date: Sat, 21 Apr 2018 11:16:15 +0000 (+0200) Subject: On login print all lines without doing further processing X-Git-Url: http://git.ipfire.org/?p=nitsi.git;a=commitdiff_plain;h=736f73dbc1a4bc7967513fbf20283060249633ef On login print all lines without doing further processing We increase the speed by 5 when we print all lines which are terminated by \n when we get the full boot log. The line we a re logging for is not terminated by \n Signed-off-by: Jonatan Schlag --- diff --git a/test.py b/test.py index 53f0052..f7f7c66 100755 --- a/test.py +++ b/test.py @@ -274,17 +274,33 @@ class connection(): print("We are not logged in") return False + def print_lines_in_buffer(self): + while True: + self.log.debug("Fill buffer ...") + self.peek(len(self.buffer) + self.in_waiting) + self.log.debug("Current buffer length: {}".format(len(self.buffer))) + if self.line_in_buffer() == True: + while self.line_in_buffer() == True: + data = self.readline() + self.log_console_line(data.decode()) + else: + self.log.debug("We have printed all lines in the buffer") + break + def login(self, password): if self.username == None: self.log.error("Username cannot be blank") return False + self.print_lines_in_buffer() + # Hit enter to see what we get self.con.write(b'\n') # We get two new lines \r\n ? data = self.readline() self.log_console_line(data.decode()) + self.print_lines_in_buffer() if self.back_at_prompt(): self.log.debug("We are already logged in.")