title: p.wait() does not wait for child process to terminate! Python 2.7
body: <p>I have the following code that starts a process, which copies files. However, it does not wait for process to finish, any help would be appreciated! </p>
  
  <pre><code>p = Popen([batch_command, numberID, date_string, wait_string, environment],  stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  output, errors = p.communicate()
  p.wait() # wait for process to terminate
  </code></pre>
  
  <p>I have tried using p.communicate at the end instead of p.wait(), however it didn't seem to work. I need for program to wait until all subprocesses are completed.</p>
  
  <p>I tried the following code so that the process can wait, however, it did not really help.</p>
  
  <pre><code>while p.poll() is None: 
      time.sleep(0.5)                     
  log.write("Process is running...")
  </code></pre>
  
  <p>Attempting to do it with win32api as a ctype, I came up with the following python script to implement a waiting time until the process is completed. I want it to wait until its completed, I do not want to kill it.</p>
  
  <pre><code>if p.returncode is None:
      if win32event.WaitForSingleObject(p._handle, 0) == win32event.WAIT_OBJECT_0:
                  p.returncode = GetExitCodeProcess(p._handle)
  return p.returncode
  </code></pre>