From 9e31d6d05d5bf7edfdc39d326bead099cc565562 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Wed, 15 Jun 2022 19:38:40 +0200 Subject: [PATCH] Revert "cppcheckdata.py: better handling when subprocess call fails" This reverts commit 1cc3b46d32292c7dcd6b4b8aeb66b7a766af6d36. --- addons/cppcheckdata.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/addons/cppcheckdata.py b/addons/cppcheckdata.py index bba9c049b..f56081923 100755 --- a/addons/cppcheckdata.py +++ b/addons/cppcheckdata.py @@ -1391,11 +1391,7 @@ def get_path_premium_addon(): def cmd_output(cmd): - if sys.platform == 'win32': - p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - else: - p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, preexec_fn=os.setsid) - comm = p.communicate() - if p.returncode == 0: - return comm[0].decode(encoding='utf-8', errors='ignore') - return comm[1].decode(encoding='utf-8', errors='ignore') + try: + return subprocess.check_output(cmd).strip().decode('ascii') + except subprocess.CalledProcessError as e: + return e.output