Commit aa370ca3 authored by Kirill Smelkov's avatar Kirill Smelkov

fixup! X neotest/runTestSuite: Tee tested process stdout,stderr to testnode logs incrementally

Don't try to play with file.readline() - that seems to be working for
usual cases, but:

1. it does not work for cases when e.g. a dot is printed for every test
   run on the same line (e.g. neo/py tests, pytest, etc...)

2. in case when there is a lot of output available ready to be read it
   would be a waste of resources to read/flush it line by line.

-> use raw OS read with sane semantics.
parent 01bb0bf8
...@@ -124,8 +124,14 @@ def main(): ...@@ -124,8 +124,14 @@ def main():
# tee, similar to tee(1) utility, copies data from fin to fout appending them to buf. # tee, similar to tee(1) utility, copies data from fin to fout appending them to buf.
def tee(fin, fout, buf): def tee(fin, fout, buf):
while 1: while 1:
# NOTE readline, not read, because file.read(N) actually waits for N # NOTE use raw os.read because it does not wait for full data to be available.
data = fin.readline(4096) # ( we could use fin.readline(), but there are cases when e.g. progress
# is reported via printing consequent dots on the same line and
# readline() won't work for that.
#
# besides when a lot of output is available it would be a waste to
# read/flush it line-by-line. )
data = os.read(fin.fileno(), 4096)
if not(data): if not(data):
return # EOF return # EOF
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment