question: public int waitFor ( ) throws InterruptedException { int r = process . waitFor ( ) ; if ( input != null ) input . join ( ) ; if ( output != null ) output . join ( ) ; if ( error != null ) error . join ( ) ; process . destroy ( ) ; return r ; }
target:  Wait for the process to complete, and all pending output to finish.