diff --git a/srcs/shell_script.c b/srcs/shell_script.c index e82480a..23e28a4 100644 --- a/srcs/shell_script.c +++ b/srcs/shell_script.c @@ -6,13 +6,14 @@ /* By: lperrey +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/10/26 23:47:44 by lperrey #+# #+# */ -/* Updated: 2021/12/18 05:29:27 by lperrey ### ########.fr */ +/* Updated: 2021/12/18 08:51:46 by lperrey ### ########.fr */ /* */ /* ************************************************************************** */ #include "minishell.h" static char *read_input_script(t_all *c); +static void exit_signal(t_all *c); void shell_script(t_all *c) { @@ -34,6 +35,8 @@ void shell_script(t_all *c) if (!c->pipeline) break ; exec_cmd_line(c); + if (get_last_exit_status() > EXIT_SIGNAL) + exit_signal(c); } } free(line_input); @@ -56,3 +59,9 @@ static char *read_input_script(t_all *c) exit_free(c, get_last_exit_status()); return (line_input); } + +static void exit_signal(t_all *c) +{ + write(STDOUT_FILENO, "\n", 1); + exit_free(c, get_last_exit_status()); +}