From 42e1e6bd470db41c5a6ed9b91d54640e87730a0e Mon Sep 17 00:00:00 2001 From: Se7enZ Date: Wed, 6 Mar 2024 18:10:08 +0100 Subject: [PATCH] pyln: Close tailable process file descriptors on stop. --- contrib/pyln-testing/pyln/testing/utils.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/contrib/pyln-testing/pyln/testing/utils.py b/contrib/pyln-testing/pyln/testing/utils.py index f0a4e2336bb6..a9c0f2d9e450 100644 --- a/contrib/pyln-testing/pyln/testing/utils.py +++ b/contrib/pyln-testing/pyln/testing/utils.py @@ -215,6 +215,12 @@ def __init__(self, outputDir, verbose=True): # pass it to the log matcher and not print it to stdout). self.log_filter = lambda line: False + def _cleanup_output_files(self): + self.stdout_write.close() + self.stderr_write.close() + self.stdout_read.close() + self.stderr_read.close() + def start(self, stdin=None, stdout_redir=True, stderr_redir=True): """Start the underlying process and start monitoring it. If stdout_redir is false, you have to make sure logs go into @@ -249,6 +255,7 @@ def stop(self, timeout=10): self.proc.kill() self.proc.wait() + self._cleanup_output_files() return self.proc.returncode def kill(self):