Faster output and no deadlocks
- Use the
select
module to do non-blocking reads from the shell process, instead of reading 1 byte at a time. Leads to significantly faster output for large streams, without any blocking. - Use
process.communicate()
to read stdout and stderr without causing deadlock due to buffer overflow.