the double loop allows the inner loop to get all of the current contents of the tempfile and when it hits an EOF we will check to ensure the thread is still running and try reading again.  It ensures we don't exit the reading of the output before it is truly complete.