Improved proc.wait_for_pid_in_file so that it first waits for the file and then waits for the process to show up.