title: Connect two processes started with asyncio.subprocess.create_subprocess_exec()
body: <p>When starting two processes with the old school <code>subprocess.Popen()</code> API, I can easily connect <em>standard out</em> of one process to <em>standard in</em> of another process, creating a pipeline in the same way as a UNIX shell will do when connecting commands with <code>|</code>:</p>
  
  <pre><code>from subprocess import Popen, PIPE
  
  process_1 = Popen(['ls'], stdout = PIPE)
  process_2 = Popen(['wc'], stdin = process_1.stdout)
  
  process_1.wait()
  process_2.wait()
  </code></pre>
  
  <p>How can I accomplish the same when using the asynchronous API from <code>asyncio.subprocess.create_subprocess_exec()</code> (or similar)? This is what I tried:</p>
  
  <pre><code>from asyncio.events import get_event_loop
  from asyncio.subprocess import PIPE, create_subprocess_exec
  
  async def main():
      process_1 = await create_subprocess_exec('ls', stdout = PIPE)
      process_2 = await create_subprocess_exec('wc', stdin = process_1.stdout)
  
      await process_1.wait()
      await process_2.wait()
  
  get_event_loop().run_until_complete(main())
  </code></pre>
  
  <p>But the second call to <code>create_subprocess_exec()</code> complains that the argument passed to <code>stdin</code> has no <code>fileno</code> (which is true):</p>
  
  <pre><code>Traceback (most recent call last):
    File ".../test-async.py", line 11, in &lt;module&gt;
       get_event_loop().run_until_complete(main())
  [...]
    File ".../test-async.py", line 6, in main
       process_2 = await create_subprocess_exec('wc', stdin = process_1.stdout)
  [...]
    File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 1388, in _get_handles
       p2cread = stdin.fileno()
  AttributeError: 'StreamReader' object has no attribute 'fileno'
  </code></pre>
  
  <p>How can I get the same result as in the synchronous example above?</p>