title: Python subprocess .check_call vs .check_output
body: <p>My python script (python 3.4.3) calls a bash script via subprocess:</p>
  
  <pre><code>import subprocess as sp
  res = sp.check_output("bashscript", shell=True)
  </code></pre>
  
  <p>The <strong>bashscript</strong> contains the following line:</p>
  
  <pre><code>ssh -MNf somehost
  </code></pre>
  
  <p>which opens a shared master connection to some remote host to allow some subsequent operations.</p>
  
  <p>When executing the python script, it will prompt for password for the <code>ssh</code> line but then it blocks after the password is entered and never returns. When I ctrl-C to terminate the script, I see that the connection was properly established (so <code>ssh</code> line was successfully executed).</p>
  
  <p>I don't have this blocking problem when using <code>check_call</code> instead of <code>check_output</code>, but <code>check_call</code> does not retrieve stdout. I'd like to understand what exactly is causing the blocking behavior for <code>check_output</code>, probably related to some subtlety with <code>ssh -MNf</code>.</p>