Skip to content

Commit fed1ec8

Browse files
committed
fix: Change the read_text implementation of CustomPosixPath to avoid
hanging due to large output Signed-off-by: Baczek, Arkadiusz <arkadiusz.baczek@intel.com>
1 parent 88bda68 commit fed1ec8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mfd_connect/pathlib/path.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,8 @@ def samefile(self, other_path: CustomPath) -> bool: # noqa:D102
400400
)
401401

402402
def read_text(self, encoding: Optional[str] = None, errors: Optional["Iterable"] = None) -> str: # noqa:D102
403-
return self._owner.execute_command(f"cat {self}", expected_return_codes=None).stdout
403+
proc = self._owner.start_process(f"cat {self}")
404+
return "".join(chunk for chunk in proc.get_stdout_iter())
404405

405406
def touch(self, mode: int = 0o666, exist_ok: bool = True) -> None: # noqa:D102
406407
if not exist_ok and self.is_file():

0 commit comments

Comments
 (0)