Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyln-testing: Fix BitcoinD FD leak #7669

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading