title: Python subprocess.Popen not working when stdout=tempfile is used
body: <p>I have Python script that runs some tests using <em>subprocess.Popen()</em> without blocking.</p>
  
  <pre><code>import datetime, os,subprocess, tempfile, time
  
  tempfile.tempdir = None
  tempFile = tempfile.TemporaryFile( bufsize=0 )
  #args = ['ls'] # or whatever, to reproduce
  process = subprocess.Popen( args, shell=False, bufsize=0, stdout=tempFile,
                              stderr=tempFile, preexec_fn=os.setsid, env=os.environ )
  
  
  while process.poll() is None:
      time.sleep( 5 )
      now = datetime.datetime.now()
  </code></pre>
  
  <p><em>process</em> is not returning any error.</p>
  
  <p>If I remove <strong>stdout=tempFile</strong> then the test runs without any problem.</p>
  
  <p>I'm using Python 2.7.3</p>