title: Python subprocess readline with timeout
body: <p>Hello i have such problem, i need to execute some command and wait for it's output, but before reading output i need to write <code>\n</code> to pipe. This the unitest, so in some cases command witch i test don't answer and my testcase stopping at <code>stdout.readline()</code> and waiting for smth. So my question is, is it possible to set something like timeout to reading line.</p>
  
  <pre><code>cmd = ['some', 'list', 'of', 'commands']
  fp = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  fp.stdin.write('\n')
  fp.stdout.readline()
  out, err = fp.communicate()
  </code></pre>