I use Sanitizer to compile C code, my compile cmd is:
gcc -fsanitize=address -fsanitize=leak -o test test.c
.
When I run ./test in shell, I got the LeakSanitizer Error info.
But When I use subprocess
to run ./test in python, I got no stderr and the returncode is 0.
My python code:
cmd = './test'
return_info = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
outs, errs = return_info.communicate(timeout=15)
errmsg = errs.decode()
if errmsg == '':
print('err None')
print(f'return code: {return_info.returncode}')
Is there any way to monitor leaksanitizer's results in python?