Switch wait command to use topics

Prior to this fix, the wait command used waitpid() directly. Switch it to
calling process_mark_finished_children() along with the rest of the job
machinery. This centralizes the waitpid call to a single location.
This commit is contained in:
ridiculousfish
2019-03-02 16:45:15 -08:00
parent dc27de8190
commit dac5d79059
5 changed files with 15 additions and 12 deletions

View File

@@ -983,13 +983,10 @@ void proc_pop_interactive() {
if (is_interactive != old) signal_set_handlers();
}
pid_t proc_wait_any() {
int pid_status;
pid_t pid = waitpid(-1, &pid_status, WUNTRACED);
if (pid == -1) return -1;
handle_child_status(pid, proc_status_t::from_waitpid(pid_status));
void proc_wait_any() {
ASSERT_IS_MAIN_THREAD();
process_mark_finished_children(true /* block_ok */);
process_clean_after_marking(is_interactive);
return pid;
}
void hup_background_jobs() {