fixed argv open().

previously wrongly dup2() to STDIN.
This commit is contained in:
lperrey
2021-12-20 22:52:41 +01:00
parent 6a9b7bae1b
commit 8ed97346f7
11 changed files with 78 additions and 87 deletions

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/10 23:53:17 by lperrey #+# #+# */
/* Updated: 2021/12/20 18:06:15 by lperrey ### ########.fr */
/* Updated: 2021/12/20 22:47:26 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
@@ -20,7 +20,13 @@ int exit_free(t_all *c, int exit_status)
ft_free_2d_arr(environ);
ft_free_2d_arr(c->path);
free_pipeline(&c->pipeline);
if (!isatty(STDIN_FILENO))
if (c->script_fd)
{
gnl(c->script_fd, NULL, 1);
if (close(c->script_fd) == -1)
perror("close()");
}
else if (!isatty(STDIN_FILENO))
gnl(STDIN_FILENO, NULL, 1);
else
rl_clear_history();