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:
parent
81c9444cd5
commit
3b40125d4a
1 changed files with 2 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue