Functions for running external commands in subprocesses.
Simple interface for executing POSIX-style pipes based on the subprocess module. The only complication is the adaptation of subprocess.Popen._comminucate to listen to the stderrs of all processes involved in the pipe, as well as the terminal process’ stdout. There are two implementations of Pipe._communicate, one for MS Windows, and one for POSIX systems. The MS Windows implementation is currently untested.
>>> p = Pipe([['find', '/etc/'], ['grep', '^/etc/ssh$']])
>>> p.stdout
'/etc/ssh\n'
>>> p.status
1
>>> p.statuses
[1, 0]
>>> p.stderrs
[...find: ...: Permission denied..., '']
expect should be a tuple of allowed exit codes. cwd should be the directory from which the command will be executed. When unicode_output == True, convert stdout and stdin strings to unicode before returing them.