diff --git a/bindings/python-examples/tests.py b/bindings/python-examples/tests.py index cc9ab441d..10531c30d 100755 --- a/bindings/python-examples/tests.py +++ b/bindings/python-examples/tests.py @@ -1512,7 +1512,8 @@ def divert_end(self): if not self.filename: return "" os.lseek(self.fd, os.SEEK_SET, 0) - content = os.read(self.fd, 1024) # 1024 is more than needed + with os.fdopen(self.fd, 'rb') as file: + content = file.read() os.dup2(self.savedfd, self.fd) os.close(self.savedfd) os.unlink(self.filename)