Skip to content

Commit 16b94ab

Browse files
authored
Merge pull request #136 from jbemmel/modify-buffer-cleanout
Revert cleaning of buffer for other platforms than SR OS
2 parents 2715942 + 12db0ef commit 16b94ab

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

common/vrnetlab.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ def restart(self):
636636
self.stop()
637637
self.start()
638638

639-
def wait_write(self, cmd, wait="__defaultpattern__", con=None):
639+
def wait_write(self, cmd, wait="__defaultpattern__", con=None, clean_buffer=False):
640640
"""Wait for something on the serial port and then send command
641641
642642
Defaults to using self.tn as connection but this can be overridden
@@ -659,7 +659,7 @@ def wait_write(self, cmd, wait="__defaultpattern__", con=None):
659659
res = con.read_until(wait.encode())
660660

661661
cleaned_buf = (
662-
con.read_very_eager()
662+
(con.read_very_eager()) if clean_buffer else None
663663
) # Clear any remaining characters in buffer
664664

665665
self.logger.trace(f"read from {con_name}: '{res.decode()}'")

sros/docker/launch.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -631,9 +631,13 @@ def __init__(self, username, password, ram, conn_mode, cpu=2, num=0):
631631
self.cpu = cpu
632632
self.qemu_args.extend(["-cpu", "host", "-smp", f"{cpu}"])
633633

634-
# override default wait patter with hash followed by the space
634+
# override default wait pattern with hash followed by the space
635635
self.wait_pattern = "# "
636636

637+
# override wait_write clean_buffer parameter default
638+
def wait_write(self, cmd, wait="__defaultpattern__", con=None, clean_buffer=True):
639+
super().wait_write( cmd, wait, con, clean_buffer)
640+
637641
def bootstrap_spin(self):
638642
"""This function should be called periodically to do work."""
639643

0 commit comments

Comments
 (0)