Skip to content

Commit

Permalink
pyln: Close tailable process file descriptors on stop.
Browse files Browse the repository at this point in the history
  • Loading branch information
s373nZ committed Mar 6, 2024
1 parent f101af3 commit 42e1e6b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions contrib/pyln-testing/pyln/testing/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 42e1e6b

Please sign in to comment.