test/lvm2: separate stdout and stderr

In all the invocation of `subprocess.run` stderr and stdout were both
combined in a shared pipe, but lvm sometimes spits out notices and
informational messages on stderr and thus potentially interfering
with the data we are interested in on stdout. Separate the two.
This commit is contained in:
Christian Kellner 2022-03-01 23:35:08 +01:00 committed by Tomáš Hozza
parent 81c9444cd5
commit 3b40125d4a

View file

@ -81,13 +81,13 @@ def list_vgs():
res = subprocess.run(cmd,
check=False,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
stderr=subprocess.PIPE,
encoding="UTF-8")
data = res.stdout.strip()
if res.returncode != 0:
msg = f"vgs: {data}"
msg = f"vgs: {res.stderr.strip()}"
raise RuntimeError(msg)
data = json.loads(data)