The need:
- Timeout after X seconds, and kill the process (and all the processes it opened) if timeout reached before the process ends gracefully.
- Read ongoing output at runtime.
- Work with processes that produce output, ones that don't, and ones that produce output, and then stop producing it (e.g. get stuck).
- Run on Windows.
- Run on Python 3.5.2.
Python 3 subprocess module has timeout built in, and I've also tried and implemented timeout myself using timer and using threads, but it doesn't work with the output. readline()
is blocking or not? readlines()
is definitely waiting for the process to end before spitting out all the output, which is not what I need (I need ongoing).
I am close to switching to node.js :-(