Features
- Added a new capture method (monitor)
- There are now two distinct methods to capture output
- Spawning a thread to enforce timeouts, and using process.communicate() (monitor method)
- Spawning a thread to readlines from stdout pipe to an output queue, and reading from that output queue while enforcing timeouts (polller method)
- On the fly output (live_output=True) option is now explicit (uses poller method only)
- Returns partial stdout output when timeouts are reached
- Returns partial stdout output when CTRL+C signal is received (only with poller method)
Fixes
- CRITICAL: Fixed rare annoying but where output wasn't complete
- Use process signals in favor of direct os.kill API to avoid potential race conditions when PID is reused too fast
- Allow full process subtree killing on Windows & Linux, hence not blocking multiple commands like echo "test" && sleep 100 && echo "done"
- Windows does not maintain an explicit process subtree, so we runtime walk processes to establish the child processes to kill. Obviously, orphaned processes cannot be killed that way.-
Misc
- Adds a default 16K stdout buffer
- Default command execution timeout is 3600s (1 hour)
- Highly improved tests
- All tests are done for both capture methods
- Timeout tests are more accurate
- Added missing encoding tests
- 2500 rounds of file reading and comparaison are added to detect rare queue read misses