Skip to content

Commit

Permalink
pyln-testing: Fix file descriptor leak in bitcoind fixture. ([#7130])
Browse files Browse the repository at this point in the history
Changelog-Fixed: pyln-testing: Fix file descriptor leak in bitcoind fixture. ([#7130])
  • Loading branch information
s373nZ committed Sep 17, 2024
1 parent 9e8dd15 commit e35e3c5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions contrib/pyln-testing/pyln/testing/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ def bitcoind(directory, teardown_checks):
bitcoind.proc.kill()
bitcoind.proc.wait()

bitcoind.cleanup_files()


class TeardownErrors(object):
def __init__(self):
Expand Down
8 changes: 8 additions & 0 deletions contrib/pyln-testing/pyln/testing/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,14 @@ def kill(self):
self.proc.kill()
self.proc.wait()

def cleanup_files(self):
"""Ensure files are closed."""
for f in ["stdout_write", "stderr_write", "stdout_read", "stderr_read"]:
try:
getattr(self, f).close()
except Exception:
pass

def logs_catchup(self):
"""Save the latest stdout / stderr contents; return true if we got anything.
"""
Expand Down

0 comments on commit e35e3c5

Please sign in to comment.