attempt chunked output to avoid message too long error
All checks were successful
Test / Test (push) Successful in 1m0s

This commit is contained in:
John Burwell 2023-08-31 13:02:10 -05:00
parent d729d69ea3
commit 42d578da76

View File

@ -105,14 +105,26 @@ class Console():
input_lines.append(input_line)
return ''.join(input_lines)
def write_chunk(self, chunk: str) -> None:
"""Write a chunk of data to stdout.
:param output: the chunk to write to stdout
"""
sys.stdout.write(chunk + '\r\n')
sys.stdout.flush()
def write_output(self, output: str) -> None:
"""Write something to stdout.
:param output: the string to write to stdout
"""
sys.stdout.write(output + '\r\n')
sys.stdout.flush()
chunk_size = 256 # Adjust the chunk size as needed
for i in range(0, len(output), chunk_size):
chunk = output[i:i + chunk_size]
self.write_chunk(chunk)
def print_configuration(self) -> None:
"""Print the current running configuration.