STINNER Victor added the comment:
> How do you do that with the subprocess module
Something like that:
---
import subprocess
ls = subprocess.Popen(["ls", "-1"], stdout=subprocess.PIPE)
wc = subprocess.Popen(["wc", "-l"], stdin=ls.stdout)
ls.wait()
wc.wait()
---
> and why doesn't that work with asyncio?
It's possible with the two methods of an event loop, but I'm requesting this
feature for the high-level API: asyncio.subprocess.
create_subprocess_shell("cat", stdout=subprocess.PIPE) starts immediatly to
consume stdout, before I can connect the pipe to "wc" stdin. Currently, the
asyncio.subprocess is designed to be able to write:
---
proc = yield from create_subprocess_exec("ls", stdout=subprocess.PIPE)
stdout, _ = yield from proc.communicate()
---
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue21080>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com