question: public static void waitForProcessOutput ( Process self , Appendable output , Appendable error ) { Thread tout = consumeProcessOutputStream ( self , output ) ; Thread terr = consumeProcessErrorStream ( self , error ) ; try { tout . join ( ) ; } catch ( InterruptedException ignore ) { } try { terr . join ( ) ; } catch ( InterruptedException ignore ) { } try { self . waitFor ( ) ; } catch ( InterruptedException ignore ) { } closeStreams ( self ) ; }
target:  Gets the output and error streams from a process and reads them to keep the process from blocking due to a full output buffer. The processed stream data is appended to the supplied Appendable. For this, two Threads are started, but join()ed, so we wait. As implied by the waitFor... name, we also wait until we finish as well. Finally, the input, output and error streams are closed.