CO-CODE Hugo-Luke

+ signals handling adjusted
+ wait_subshell() with last_exit_status
+ miscs
This commit is contained in:
LuckyLaszlo
2021-11-17 01:35:06 +01:00
parent 965cf99ca5
commit 26993144cc
8 changed files with 185 additions and 128 deletions

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/10 23:53:17 by lperrey #+# #+# */
/* Updated: 2021/11/16 22:24:36 by lperrey ### ########.fr */
/* Updated: 2021/11/17 01:25:35 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
@@ -18,6 +18,7 @@ int free_exit(t_all *c, int exit_status)
free(c->prompt);
ft_lstclear((t_list **)&c->token_list, free); // a voir avec Hugo, il y a un truc qui me semble superflu dans la fonction
ft_free_2d_arr(c->envp);
ft_free_2d_arr(c->path);
free_pipeline(&c->cmd_arr);
//if (c->termios_changed)
// tcsetattr(STDIN_FILENO, TCSANOW, &c->ori_termios);
@@ -55,11 +56,17 @@ void close_pipeline_fd(t_cmd *pipeline[])
while (pipeline[i])
{
if (pipeline[i]->fd_in != STDIN_FILENO && pipeline[i]->fd_in > 0)
{
if (close(pipeline[i]->fd_in) == -1)
perror("close()");
pipeline[i]->fd_in = 0;
}
if (pipeline[i]->fd_out != STDOUT_FILENO && pipeline[i]->fd_out > 0)
{
if (close(pipeline[i]->fd_out) == -1)
perror("close()");
pipeline[i]->fd_out = 0;
}
i++;
}
}