Merge #1257: qa: pipe stderr to stdout, not PIPE

26ade7ebdd3b35667e07ba34986c7e25dd857f89 qa: pipe stderr to stdout, not PIPE (Antoine Poinsot)

Pull request description:

  It turns out that setting both to PIPE would result in stderr not being read for some reason. So follow
  https://docs.python.org/3/library/subprocess.html and set stdout to PIPE and stderr to STDOUT.

  Tested with a process (electrs) which logs on stderr.

ACKs for top commit:
  darosior:
    ACK 26ade7ebdd3b35667e07ba34986c7e25dd857f89 -- tested by running the functional tests in parallel for #1222 and could correctly get the logs to debug the issue.

Tree-SHA512: fb4303474411bb818a2743ab675af476d132eb25bb8138d691d6f205febf8c863716bc9c8f400ab30876c3f0b376531ba96932946847e9068e641fa9b5edf7d4
This commit is contained in:
Antoine Poinsot 2024-09-04 11:31:12 +02:00
commit 1b7bb9485a
No known key found for this signature in database
GPG Key ID: E13FC145CD3F4304

View File

@ -303,7 +303,7 @@ class TailableProc(object):
self.cmd_line,
stdin=stdin,
stdout=stdout if stdout else subprocess.PIPE,
stderr=stderr if stderr else subprocess.PIPE,
stderr=stderr if stderr else subprocess.STDOUT,
env=self.env,
)
self.thread = threading.Thread(target=self.tail)
@ -347,7 +347,7 @@ class TailableProc(object):
be picked up by consumers.
"""
out = self.proc.stdout.readline
err = self.proc.stderr.readline
err = self.proc.stderr.readline if self.proc.stderr else lambda: ""
for line in itertools.chain(iter(out, ""), iter(err, "")):
if len(line) == 0:
break