Spawn a shell pipeline with `create_subprocess_shell()`.
Section: Subprocesses
Run a shell command asynchronously
python
python
import asyncio
async def main():
proc = await asyncio.create_subprocess_shell(
"echo one && echo two",
stdout=asyncio.subprocess.PIPE,
)
stdout, _ = await proc.communicate()
print(stdout.decode())
asyncio.run(main())Explanation
Convenient for shell pipelines, but avoid untrusted input.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Subprocesses