Fix a race condition in wait_reading_process_output (tiny change).