From fa474c86ab999dd12febef9b18107a2235a216bd Mon Sep 17 00:00:00 2001 From: LuckyLaszlo Date: Sat, 18 Dec 2021 08:55:54 +0100 Subject: [PATCH] fixed signal exit in shell_script() --- srcs/shell_script.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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()); +}