/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* process_helpers.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: sede-san content; minishell_set_child_signals(); executor_setup_child_input(pipeline); executor_setup_child_output(current_command, pipeline); if (!executor_apply_redirections(command, NULL, NULL, NULL)) exit(EXIT_FAILURE); exit_status = executor_execute_command(command, minishell); exit(exit_status); } void executor_parent_cleanup( t_list *current_command, t_pipeline *pipeline ) { if (pipeline->prev_read_fd != -1) close(pipeline->prev_read_fd); if (current_command->next) { close(pipeline->pipefd[WRITE_PIPE]); pipeline->prev_read_fd = pipeline->pipefd[READ_PIPE]; } else pipeline->prev_read_fd = -1; } uint8_t executor_wait_for_children( pid_t last_child_pid ) { uint8_t exit_status; int status; pid_t pid; exit_status = EXIT_SUCCESS; pid = wait(&status); while (last_child_pid > 0 && pid > 0) { if (pid == last_child_pid) set_last_child_status(status, &exit_status); pid = wait(&status); } return (exit_status); }