introduce platform independent wait_for_process function