diff options
author | Andres Gomez <agomez@igalia.com> | 2021-05-17 22:50:21 +0300 |
---|---|---|
committer | Andres Gomez <agomez@igalia.com> | 2021-05-18 12:06:44 +0300 |
commit | 9d87cc3d79e0c7e572273b94dcb51882f4d83d7f (patch) | |
tree | 6c0385fed493ec04ca49be08d39dfa578c05dc7d /framework | |
parent | 3b84e8a37ec149160e95aef2e9b0dfa262da7d69 (diff) |
framework/replay: send backend's subprocess stderr to sys.stderr
Make it explicit, in case it was redirected for the parent process.
See: https://bugs.python.org/issue44158
Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Martin Peres <martin.peres@mupuf.org>
Part-of: <https://gitlab.freedesktop.org/mesa/piglit/-/merge_requests/534>
Diffstat (limited to 'framework')
-rw-r--r-- | framework/replay/backends/abstract.py | 8 | ||||
-rw-r--r-- | framework/replay/backends/apitrace.py | 3 | ||||
-rw-r--r-- | framework/replay/backends/gfxreconstruct.py | 5 |
3 files changed, 12 insertions, 4 deletions
diff --git a/framework/replay/backends/abstract.py b/framework/replay/backends/abstract.py index f84a4e0e3..937d3a8d1 100644 --- a/framework/replay/backends/abstract.py +++ b/framework/replay/backends/abstract.py @@ -33,6 +33,7 @@ This module provides a base class for replayer dump backend modules. import abc import functools import subprocess +import sys from os import path @@ -89,7 +90,12 @@ class DumpBackend(metaclass=abc.ABCMeta): @staticmethod def _run_logged_command(cmd, env): - ret = subprocess.run(cmd, stdout=subprocess.PIPE, env=env) + # Explicitly send the stderr to the fd at sys.stderr in case it was + # redirected for the parent process. + # See: + # https://bugs.python.org/issue44158 + ret = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=sys.stderr, + env=env) logoutput = '[dump_trace_images] Running: {}\n'.format( ' '.join(cmd)).encode() + ret.stdout print(logoutput.decode(errors='replace')) diff --git a/framework/replay/backends/apitrace.py b/framework/replay/backends/apitrace.py index 692badeb8..07d935c52 100644 --- a/framework/replay/backends/apitrace.py +++ b/framework/replay/backends/apitrace.py @@ -29,6 +29,7 @@ import os import subprocess +import sys from os import path @@ -94,7 +95,7 @@ class APITraceBackend(DumpBackend): default='apitrace') cmd = cmd_wrapper + [apitrace_bin, 'dump', '--calls=frame', self._trace_path] - ret = subprocess.run(cmd, stdout=subprocess.PIPE) + ret = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=sys.stderr) logoutput = '[dump_trace_images] Running: {}\n'.format( ' '.join(cmd)) + ret.stdout.decode(errors='replace') print(logoutput) diff --git a/framework/replay/backends/gfxreconstruct.py b/framework/replay/backends/gfxreconstruct.py index b247a5b67..8186e8130 100644 --- a/framework/replay/backends/gfxreconstruct.py +++ b/framework/replay/backends/gfxreconstruct.py @@ -30,6 +30,7 @@ import os import re import subprocess +import sys from packaging import version from os import path @@ -79,7 +80,7 @@ class GFXReconstructBackend(DumpBackend): ('replay', 'gfxrecon-info_bin'), default='gfxrecon-info') cmd = [gfxrecon_info_bin, self._trace_path] - ret = subprocess.run(cmd, stdout=subprocess.PIPE) + ret = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=sys.stderr) lines = ret.stdout.decode(errors='replace').splitlines() print(ret.stdout.decode(errors='replace')) try: @@ -90,7 +91,7 @@ class GFXReconstructBackend(DumpBackend): def _check_version(self, gfxrecon_replay_bin): cmd = [gfxrecon_replay_bin, '--version'] - ret = subprocess.run(cmd, stdout=subprocess.PIPE) + ret = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=sys.stderr) lines = ret.stdout.decode(errors='replace').splitlines() print(ret.stdout.decode(errors='replace')) try: |