I have the following Python code in which I'm calling a Makefile by embedding the bash command from within the python script. I want to check if a warning is reported on the stdout. I do see the warning on the stdout but my Python code does not seem to be detecting it.
Python Code:
maker = subprocess.Popen(["bash", "-c", "make"], stdout=subprocess.PIPE)
for line in maker.stdout:
if "warning:" in line:
print "Warning(s) detected in make"
Output on stdout which clearly reports a warning:
main.c: In function ‘main’:
main.c:46:14: warning: unused variable ‘options’ [-Wunused-variable]