Python subprocess.Popen pipe custom fd
<p>I currently have this code that pipe stdout or stderr following the context:</p>

<pre><code>def execteInstruction(cmd, outputNumber):
  do_stdout = DEVNULL
  do_stderr = DEVNULL
  if outputNumber != 2:
    do_stdout = subprocess.PIPE
  else:
    do_stderr = subprocess.PIPE
  return subprocess.Popen(cmd, shell=True, stderr=do_stderr, stdout=do_stdout)
</code></pre>

<p>And then I read the result with <code>communicate()</code>. This works perfectly well except that I need to read a custom fd because I'm using subprocess to run a command that output on the file descriptor 26.</p>

<p>I have seen code that write to another fd than stdout or stderr, but none that read from a custom fd. 
So how can I pipe a custom fd from subprocess.Popen ?</p>