cppcheckdata.py: fix cmd_output() function, handle errors better
This commit is contained in:
parent
61f846073d
commit
b44a38bf7f
|
@ -1391,7 +1391,10 @@ def get_path_premium_addon():
|
||||||
|
|
||||||
|
|
||||||
def cmd_output(cmd):
|
def cmd_output(cmd):
|
||||||
try:
|
with subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) as p:
|
||||||
return subprocess.check_output(cmd).strip().decode('ascii')
|
comm = p.communicate()
|
||||||
except subprocess.CalledProcessError as e:
|
out = comm[0]
|
||||||
return e.output
|
if p.returncode == 1 and len(comm[1]) > 2:
|
||||||
|
out = comm[1]
|
||||||
|
return out.decode(encoding='utf-8', errors='ignore')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue