From dbb83a1bc3627f71963570be230de8e9d35c1a83 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Fri, 18 Dec 2020 10:50:49 +0100 Subject: [PATCH] pyln: Do not rstrip() the return value of .append() This was causing the following error ``` Exception in thread Thread-553: Traceback (most recent call last): File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner self.run() File "/usr/lib/python3.6/threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "/tmp/cirrus-ci-build/contrib/pyln-testing/pyln/testing/utils.py", line 232, in tail self.err_logs.append(line.rstrip().decode('UTF-8', 'replace')).rstrip() AttributeError: 'NoneType' object has no attribute 'rstrip' [gw5] [ 33%] FAILED tests/test_misc.py::test_bitcoin_failure ``` Notice the second call to `.rstrip()` on the return value of `.append()` --- contrib/pyln-testing/pyln/testing/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/contrib/pyln-testing/pyln/testing/utils.py b/contrib/pyln-testing/pyln/testing/utils.py index 623fb5401..310ebde5e 100644 --- a/contrib/pyln-testing/pyln/testing/utils.py +++ b/contrib/pyln-testing/pyln/testing/utils.py @@ -227,9 +227,13 @@ class TailableProc(object): if self.proc.stderr: for line in iter(self.proc.stderr.readline, ''): + if line is None or len(line) == 0: break - self.err_logs.append(line.rstrip().decode('UTF-8', 'replace')).rstrip() + + line = line.rstrip().decode('UTF-8', 'replace') + self.err_logs.append(line) + self.proc.stderr.close() def is_in_log(self, regex, start=0):