Message214999
> 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()
--- |
|
Date |
User |
Action |
Args |
2014-03-27 23:22:07 | vstinner | set | recipients:
+ vstinner, gvanrossum, yselivanov |
2014-03-27 23:22:07 | vstinner | set | messageid: <1395962527.19.0.108609131118.issue21080@psf.upfronthosting.co.za> |
2014-03-27 23:22:07 | vstinner | link | issue21080 messages |
2014-03-27 23:22:06 | vstinner | create | |
|