Read rsync output while it runs
Read the output as it arrives, split on newlines and carriage returns, instead of all at once with communicate(). This is needed for the progress bar. Invalid UTF-8 in the output is replaced instead of raising.
This commit is contained in:
@@ -257,6 +257,8 @@ class RecordPopen:
|
||||
|
||||
def __init__(self, args: list[str], **kwargs: Any) -> None:
|
||||
RecordPopen.calls.append(args)
|
||||
self.stdin = io.BytesIO()
|
||||
self.stdout = io.BytesIO(b'sent 1 bytes received 2 bytes\ntotal size is 3\n')
|
||||
|
||||
def __enter__(self) -> 'RecordPopen':
|
||||
return self
|
||||
@@ -264,8 +266,8 @@ class RecordPopen:
|
||||
def __exit__(self, *args: Any) -> None:
|
||||
pass
|
||||
|
||||
def communicate(self) -> tuple[bytes, None]:
|
||||
return b'sent 1 bytes received 2 bytes\ntotal size is 3\n', None
|
||||
def wait(self) -> int:
|
||||
return RecordPopen.returncode
|
||||
|
||||
|
||||
@pytest.mark.usefixtures('connect')
|
||||
|
||||
Reference in New Issue
Block a user