diff --git a/include/execution.h b/include/execution.h index 451153b..e351a89 100644 --- a/include/execution.h +++ b/include/execution.h @@ -6,7 +6,7 @@ /* By: mmoussou infile, STDIN_FILENO); if (cmd->infile != STDIN_FILENO) close(cmd->infile); - if (exec.status == -1) - exit(-1); exec.status = dup2(cmd->outfile, STDOUT_FILENO); if (cmd->outfile != STDOUT_FILENO) close(cmd->outfile); @@ -65,9 +63,10 @@ void __fork_single_cmd(t_cmd *cmd, char **env, t_env *env_t, t_exec exec) close(STDOUT_FILENO); i = 2; while (i++ < 1023) - { close(i); - } + get_env_arr(env); + if (is_in_builtins(cmd->cmd)) + signal(SIGPIPE, sig_p); exec_cmd(cmd, env, env_t); } } diff --git a/src/exec/exec_split_cmd.c b/src/exec/exec_split_cmd.c index a84e125..d9f18f3 100644 --- a/src/exec/exec_split_cmd.c +++ b/src/exec/exec_split_cmd.c @@ -6,7 +6,7 @@ /* By: mmoussou