windows console program stdout is buffered when using pipe redirection
问题 i have a long run server program(say, program A) which is written in QT/c++. the program is not so stable so i decide to write a python script to restart it if it crashes. the problem is that the program may started fail(if i gave it an in-use port), print the error and then just hang there without quitting, so i must monitor the stdout of the program and kill it on failed startup. this is a piece of my final code (well, in fact this is ok, you can just ignore it): self.subp = subprocess