2 ms·
I think you're making this more complicated than it needs to be. For simple things, it's ok to just: from subprocess import run run('foo | bar', shell=True
by gvalkov 8y ago
I think you're making this more complicated than it needs to be. For simple things, it's ok to just:
from subprocess import run
run('foo | bar', shell=True, check=True)
- chriswarbo 8y agoAs that argument's name suggests, that's invoking a shell (or whatever the `shell` env var is set to, IIRC). Shells are excellent at invoking commands and piping, as I said. Doing things like piping with Python instead of a shell is indeed more complicated than it needs to be. That was my point ;)