Redirect subprocess.Popen stderr to console
<p>I am executing a make command using subprocess.Popen. But when the make fails I do not get the exact error from make and th escript just continues to run. How do I get the script to stop and show the console exactly the output of the make command</p>

<pre><code>def app(self, build, soc, target):
    command = "make BUILD=%s SOC=%s TARGET=%s" % (build, soc, target)
    subprocess.Popen(command.split(), shell=False,
                              stdout=subprocess.PIPE,
                              stderr=subprocess.PIPE).communicate()
</code></pre>

<p>Could you try replacing:</p>

<pre><code>subprocess.Popen(command.split(), shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
</code></pre>

<p>with:</p>

<pre><code>p = subprocess.Popen(command.split(), shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
print p.communicate()
print p.returncode
</code></pre>

<p>And let us know what the printed output looks like.</p>

python