summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2025-10-24 11:26:42 -0600
committerTom Rini <[email protected]>2025-11-07 14:19:46 -0600
commit20b822dd4f01a7489f888460f70d7830e0513965 (patch)
tree6d87c0d73dd8860148e236d44082a6e11deaec6a /test
parent09ca8d472e6d28b6c81c4253c172aa85a61ba25c (diff)
test/py: multiplexed_log.py: Clean up and correct RunAndLog()
The general python documentation for the subprocess class recommends that run() be used in all cases that it can handle. What we do in RunAndLog is simple enough that run() is easy to switch to. In fact, looking at this exposed a problem we have today, which is that we had combined stdout and stderr but then looked at both stdout and stderr as if they were separate. Stop combining them. Signed-off-by: Tom Rini <[email protected]>
Diffstat (limited to 'test')
-rw-r--r--test/py/multiplexed_log.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/py/multiplexed_log.py b/test/py/multiplexed_log.py
index 63237594bb4..68dc183e463 100644
--- a/test/py/multiplexed_log.py
+++ b/test/py/multiplexed_log.py
@@ -138,10 +138,10 @@ class RunAndLog(object):
self.logfile.write(self, msg)
try:
- p = subprocess.Popen(cmd, cwd=cwd,
- stdin=subprocess.PIPE if stdin else None,
- stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env)
- (stdout, stderr) = p.communicate(input=stdin)
+ p = subprocess.run(cmd, cwd=cwd, capture_output=True, input=stdin,
+ env=env)
+ stdout = p.stdout
+ stderr = p.stderr
if stdout is not None:
stdout = stdout.decode('utf-8')
if stderr is not None: