title: Wait until a certain process (knowing the "pid") end
body: <p>I have this:</p>
  
  <pre><code>def get_process():
      pids = []
      process = None
      for i in os.listdir('/proc'):
          if i.isdigit():
              pids.append(i)
  
      for pid in pids:
          proc = open(os.path.join('/proc', pid, 'cmdline'), 'r').readline()
          if proc == "Something":
              process = pid
  
      return process          
  
  def is_running(pid):
      return os.path.exists("/proc/%s" % str(pid))
  </code></pre>
  
  <p>Then i do this:</p>
  
  <pre><code>process = get_process()
  if process == None:
      #do something
  else:
      #Wait until the process end
      while is_running(process):
          pass
  </code></pre>
  
  <p>I think this is not the best way to wait for the process to terminate, there must be some function wait or something, but i can't find it.</p>
  
  <p>Disclaimer: The process is not a child process</p>