- wxEndProcessData *proc_data = it->second;
- int pid = (proc_data->pid > 0) ? proc_data->pid : -(proc_data->pid);
- int status = 0;
- // has the process really terminated?
- int rc = waitpid(pid, &status, WNOHANG);
- if (rc == 0)
- continue; // no, it didn't exit yet, continue waiting
-
- // set exit code to -1 if something bad happened
- proc_data->exitcode = rc != -1 && WIFEXITED(status) ?
- WEXITSTATUS(status) : -1;
-
- // child exited, end waiting
- close(it->first);
-
- // don't call us again!
- gs_procmap->erase(it->first);
-
- wxHandleProcessTermination(proc_data);
-
- // Iterator is invalid. Handle any further children in subsequent
- // calls.
- break;