waiting for non-child pid instead of using the bash builtin