title: python: run a process with timeout and capture stdout, stderr and exit status
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1191374/subprocess-with-timeout">subprocess with timeout</a>  </p>
  </blockquote>
  
  <p>What is the easiest way to do the following in Python:</p>
  
  <ul>
  <li>Run an external process</li>
  <li>Capture stdout in a string, stderr, and exit status</li>
  <li>Set a timeout.</li>
  </ul>
  
  <p>I would like something like this:</p>
  
  <pre><code>import proc
  
  try:
      status, stdout, stderr = proc.run(["ls", "-l"], timeout=10)
  except proc.Timeout:
      print "failed"
  </code></pre>