From a1b286d7ada052d87d93ffae404f6eb681e74159 Mon Sep 17 00:00:00 2001 From: Adam Joly Date: Mon, 15 Jul 2024 15:26:31 +0200 Subject: [PATCH] =?UTF-8?q?=E3=80=8C=F0=9F=8F=97=EF=B8=8F=E3=80=8D=20wip:?= =?UTF-8?q?=20try=20to=20fix=20ctrl=20\=20in=20cat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/exec/exec_split_cmd.c | 6 +++--- src/exec/utils_exec_2.c | 12 ++++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/exec/exec_split_cmd.c b/src/exec/exec_split_cmd.c index f759048..93237d7 100644 --- a/src/exec/exec_split_cmd.c +++ b/src/exec/exec_split_cmd.c @@ -6,7 +6,7 @@ /* By: mmoussou content, exec.env_array, \ env, exec.pipe_fd); - __sig(); + __sig(exec.status); if (((t_cmd *)(list_cmd->content))->outfile != STDOUT_FILENO) close(((t_cmd *)(list_cmd->content))->outfile); if (((t_cmd *)(list_cmd->content))->infile != STDIN_FILENO) diff --git a/src/exec/utils_exec_2.c b/src/exec/utils_exec_2.c index 8de03a9..2b4bf1e 100644 --- a/src/exec/utils_exec_2.c +++ b/src/exec/utils_exec_2.c @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/07/09 22:53:01 by adjoly #+# #+# */ -/* Updated: 2024/07/15 14:32:40 by adjoly ### ########.fr */ +/* Updated: 2024/07/15 15:23:00 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -37,8 +37,16 @@ int send_error_exec(char *input) return (-1); } -void __sig(void) +void __sig(int status) { + if (WIFSIGNALED(status) && WTERMSIG(status) == SIGQUIT) + { + get_exit_code(131); + if (WCOREDUMP(status)) + ft_putendl_fd("Quit (core dumped)", 2); + else + ft_putendl_fd("Quit", 2); + } signal(SIGQUIT, SIG_IGN); signal(SIGINT, SIG_IGN); }