Skip to content

Commit da8dcd5

Browse files
committed
testing: don't spam stderr when the log file is closed
1 parent 5463c04 commit da8dcd5

File tree

1 file changed

+10
-6
lines changed
  • contrib/pyln-testing/pyln/testing

1 file changed

+10
-6
lines changed

contrib/pyln-testing/pyln/testing/utils.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -865,12 +865,16 @@ def __init__(self, socket_path, executor=None, logger=logging,
865865
def call(self, method, payload=None, cmdprefix=None, filter=None):
866866
id = self.get_json_id(method, cmdprefix)
867867
schemas = self.jsonschemas.get(method)
868-
self.logger.debug(json.dumps({
869-
"id": id,
870-
"method": method,
871-
"params": payload,
872-
"filter": filter,
873-
}, indent=2))
868+
# Sometimes our log file is closed, don't spam stderr in this case
869+
try:
870+
self.logger.debug(json.dumps({
871+
"id": id,
872+
"method": method,
873+
"params": payload,
874+
"filter": filter,
875+
}, indent=2))
876+
except ValueError:
877+
pass
874878

875879
# We only check payloads which are dicts, which is what we
876880
# usually use: there are some cases which tests [] params,

0 commit comments

Comments
 (0)