From 3b40125d4ad8677c54076c3653553902cb3dac4e Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Tue, 1 Mar 2022 23:35:08 +0100 Subject: [PATCH] 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. --- test/mod/test_util_lvm2.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/mod/test_util_lvm2.py b/test/mod/test_util_lvm2.py index 81fd8f34..53a50923 100644 --- a/test/mod/test_util_lvm2.py +++ b/test/mod/test_util_lvm2.py @@ -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)