cppcheckdata.py: better handling when subprocess call fails
This commit is contained in:
parent
176eefcbf3
commit
1cc3b46d32
|
@ -1391,7 +1391,11 @@ def get_path_premium_addon():
|
||||||
|
|
||||||
|
|
||||||
def cmd_output(cmd):
|
def cmd_output(cmd):
|
||||||
try:
|
if sys.platform == 'win32':
|
||||||
return subprocess.check_output(cmd).strip().decode('ascii')
|
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
except subprocess.CalledProcessError as e:
|
else:
|
||||||
return e.output
|
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')
|
||||||
|
|
Loading…
Reference in New Issue