mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
pyln: Decode process output once before storing it
This commit is contained in:
parent
81569de709
commit
9021bb26d1
@ -20,6 +20,7 @@ import sqlite3
|
|||||||
import string
|
import string
|
||||||
import struct
|
import struct
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
import warnings
|
import warnings
|
||||||
@ -202,15 +203,22 @@ class TailableProc(object):
|
|||||||
for line in iter(self.proc.stdout.readline, ''):
|
for line in iter(self.proc.stdout.readline, ''):
|
||||||
if len(line) == 0:
|
if len(line) == 0:
|
||||||
break
|
break
|
||||||
if self.log_filter(line.decode('ASCII')):
|
|
||||||
|
line = line.decode('ASCII').rstrip()
|
||||||
|
|
||||||
|
if self.log_filter(line):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
logging.debug("%s: %s", self.prefix, line.decode().rstrip())
|
sys.stdout.write("{}: {}\n".format(self.prefix, line))
|
||||||
|
|
||||||
with self.logs_cond:
|
with self.logs_cond:
|
||||||
self.logs.append(str(line.rstrip()))
|
self.logs.append(line)
|
||||||
self.logs_cond.notifyAll()
|
self.logs_cond.notifyAll()
|
||||||
|
|
||||||
self.running = False
|
self.running = False
|
||||||
self.proc.stdout.close()
|
self.proc.stdout.close()
|
||||||
|
|
||||||
if self.proc.stderr:
|
if self.proc.stderr:
|
||||||
for line in iter(self.proc.stderr.readline, ''):
|
for line in iter(self.proc.stderr.readline, ''):
|
||||||
if len(line) == 0:
|
if len(line) == 0:
|
||||||
|
@ -2125,7 +2125,7 @@ def test_dataloss_protection(node_factory, bitcoind):
|
|||||||
# be zero)
|
# be zero)
|
||||||
"[0-9a-f]{64}"
|
"[0-9a-f]{64}"
|
||||||
# my_current_per_commitment_point
|
# my_current_per_commitment_point
|
||||||
"0[23][0-9a-f]{64}'$")
|
"0[23][0-9a-f]{64}")
|
||||||
|
|
||||||
# After an htlc, we should get different results (two more commits)
|
# After an htlc, we should get different results (two more commits)
|
||||||
l1.pay(l2, 200000000)
|
l1.pay(l2, 200000000)
|
||||||
@ -2148,7 +2148,7 @@ def test_dataloss_protection(node_factory, bitcoind):
|
|||||||
# your_last_per_commitment_secret
|
# your_last_per_commitment_secret
|
||||||
"[0-9a-f]{64}"
|
"[0-9a-f]{64}"
|
||||||
# my_current_per_commitment_point
|
# my_current_per_commitment_point
|
||||||
"0[23][0-9a-f]{64}'$")
|
"0[23][0-9a-f]{64}")
|
||||||
|
|
||||||
# Now, move l2 back in time.
|
# Now, move l2 back in time.
|
||||||
l2.stop()
|
l2.stop()
|
||||||
|
@ -354,7 +354,7 @@ def test_gossip_weirdalias(node_factory, bitcoind):
|
|||||||
{'alias': normal_name}
|
{'alias': normal_name}
|
||||||
]
|
]
|
||||||
l1, l2 = node_factory.get_nodes(2, opts=opts)
|
l1, l2 = node_factory.get_nodes(2, opts=opts)
|
||||||
weird_name_json = json.encoder.JSONEncoder().encode(weird_name)[1:-1].replace('\\', '\\\\')
|
weird_name_json = json.encoder.JSONEncoder().encode(weird_name)[1:-1]
|
||||||
aliasline = l1.daemon.is_in_log('Server started with public key .* alias')
|
aliasline = l1.daemon.is_in_log('Server started with public key .* alias')
|
||||||
assert weird_name_json in str(aliasline)
|
assert weird_name_json in str(aliasline)
|
||||||
assert l2.daemon.is_in_log('Server started with public key .* alias {}'
|
assert l2.daemon.is_in_log('Server started with public key .* alias {}'
|
||||||
|
Loading…
Reference in New Issue
Block a user