Makes wait_schedule return the exit status of the process