From 7d4880b2b7097481774e59363ecb39d7d7181feb Mon Sep 17 00:00:00 2001 From: Jack Halford Date: Mon, 27 Mar 2017 19:42:49 +0200 Subject: [PATCH] :thumbsup: close #215 --- 42sh/src/exec/redirect_dless.c | 5 ++--- 42sh/src/main/shell_init.c | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/42sh/src/exec/redirect_dless.c b/42sh/src/exec/redirect_dless.c index d8063a57..e204d3c3 100644 --- a/42sh/src/exec/redirect_dless.c +++ b/42sh/src/exec/redirect_dless.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/20 12:36:10 by jhalford #+# #+# */ -/* Updated: 2017/03/25 01:45:49 by jhalford ### ########.fr */ +/* Updated: 2017/03/27 19:41:50 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -21,7 +21,6 @@ int redirect_dless(t_redir *redir) str = redir->heredoc_data; write(fds[PIPE_WRITE], str, ft_strlen(str)); close(fds[PIPE_WRITE]); - dup2(fds[PIPE_READ], redir->n); - close(fds[PIPE_READ]); + fd_replace(fds[PIPE_READ], redir->n); return (0); } diff --git a/42sh/src/main/shell_init.c b/42sh/src/main/shell_init.c index 542f1780..bfd6768d 100644 --- a/42sh/src/main/shell_init.c +++ b/42sh/src/main/shell_init.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/12 17:23:59 by jhalford #+# #+# */ -/* Updated: 2017/03/27 18:08:56 by jhalford ### ########.fr */ +/* Updated: 2017/03/27 19:41:47 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -100,5 +100,6 @@ int shell_init(int ac, char **av, char **env) if (SH_IS_INTERACTIVE(data->opts) && interactive_settings() < 0) return (-1); shell_fds_init(); + shell_fds_push(); return (0); }