23 int fd[2],
int direction);
26 pid_t *pid_1, pid_t *pid_2)
34 if (node->
right != NULL)
59 if (pid_1 > 0 && waitpid(pid_1, &status_1, 0) == -1)
63 if (waitpid(pid_2, &status_2, 0) == -1)
65 return (WEXITSTATUS(status_2));
67 return (WEXITSTATUS(status_1));
80 int fd[2],
int direction)
91 dup2(fd[1], STDOUT_FILENO);
93 dup2(fd[0], STDIN_FILENO);
int execute_ast(t_ast *node, t_ms_data *data)
execute Abstract Syntax Tree
void close_fds(int in, int out)
close two file descriptors
pid_t execute_child(t_ast *node, t_ms_data *data, int fd[2], int direction)
execute child process in the pipe context
int builtin_pipe(t_ast *node, t_ms_data *data)
static int setup_pipe_processes(t_ast *node, t_ms_data *data, pid_t *pid_1, pid_t *pid_2)
#define WAIT_NEXT_COMMAND