fix: heredoc ctrl + d close fd

This commit is contained in:
Camille Chauvet 2023-03-31 15:29:06 +02:00
parent 68c945ae05
commit 88d955fddc

View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */ /* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/17 15:36:26 by cchauvet #+# #+# */ /* Created: 2023/02/17 15:36:26 by cchauvet #+# #+# */
/* Updated: 2023/03/31 15:25:13 by alouis-j ### ########.fr */ /* Updated: 2023/03/31 15:28:31 by alouis-j ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -38,7 +38,10 @@ static int ft_heredoc2(t_data *data, char *stop, int fds[2])
ft_printf("> "); ft_printf("> ");
line = get_next_line(*ft_get_heredoc()); line = get_next_line(*ft_get_heredoc());
if (line == NULL) if (line == NULL)
{
ft_closer(fds);
return (1); return (1);
}
line[ft_strlen(line) - 1] = '\0'; line[ft_strlen(line) - 1] = '\0';
if (ft_strcmp(line, stop) == 0) if (ft_strcmp(line, stop) == 0)
{ {