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):
|
||||
try:
|
||||
return subprocess.check_output(cmd).strip().decode('ascii')
|
||||
except subprocess.CalledProcessError as e:
|
||||
return e.output
|
||||
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')
|
||||
|
|
Loading…
Reference in New Issue