title: python parallel Popen
body: <p>I've been puzzling this for whole night now... </p>
  
  <pre><code>makeflags = ['--prefix=/usr','--libdir=/usr/lib']
  rootdir='/tmp/project'
  ps = set()
  
  def configModule(m):
      print m
      return Popen(["./autogen.sh"] + makeflags, cwd=rootdir+"/"+m)
  
  for module in ['mod1','mod2','mod3' ... 'mod10']:
      ps.add(configModule(module))
  
  os.wait()
  </code></pre>
  
  <p>I was expecting it will start 10 processes and executing ./autogen.sh in parallel. However, what I observed was the first few configModule seemed to exit as soon as the functions were called. I only see the "print m" statement, but not the actual output of ./autogen.sh within "mod1". However, after about mod4, the code started to run in parallel. I can see the CPU utilization is high as well as the output has been generated in different module folders. </p>
  
  <p>Any idea why the first few modules did not produce ./autogen.sh result?</p>
  
  <p>P.S. If I run this code in serial (i.e. using subprocess.call instead of Popen) it works correctly.</p>