Skip to content

Commit

Permalink
Merge pull request #1530 from ampli/tests-py
Browse files Browse the repository at this point in the history
tests.py: divert_end(): Read the entire output
  • Loading branch information
linas authored May 20, 2024
2 parents 838f07b + 47e81f7 commit 9b9a935
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bindings/python-examples/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9b9a935

Please sign in to comment.