How to read from large process output correctly
问题 There are already a few answers on how to read from a process stream but as far as I can see they do not cover reading from a process which: may run for a long time before making any output makes a huge output at the end of its lifetime (more than the stream buffer can hold) should not run longer than a given time frame the resulted output is needed as a whole (long character string) Therefore using the mentioned solutions would either result in wasted process cycles as the loop will try to