diff --git a/contrib/pyln-testing/pyln/testing/fixtures.py b/contrib/pyln-testing/pyln/testing/fixtures.py index 13631c1be..dede9e88d 100644 --- a/contrib/pyln-testing/pyln/testing/fixtures.py +++ b/contrib/pyln-testing/pyln/testing/fixtures.py @@ -164,6 +164,8 @@ def bitcoind(directory, teardown_checks): bitcoind.proc.kill() bitcoind.proc.wait() + bitcoind.cleanup_files() + class TeardownErrors(object): def __init__(self): diff --git a/contrib/pyln-testing/pyln/testing/utils.py b/contrib/pyln-testing/pyln/testing/utils.py index 6eda2d9ff..9d1ac4a77 100644 --- a/contrib/pyln-testing/pyln/testing/utils.py +++ b/contrib/pyln-testing/pyln/testing/utils.py @@ -256,6 +256,14 @@ class TailableProc(object): 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. """