From 2f6daa4ce54ddea8253d19ded70189a859fdf1ff Mon Sep 17 00:00:00 2001 From: Camille Chauvet Date: Mon, 17 Apr 2023 10:41:54 +0000 Subject: [PATCH] fix: signal double prompt --- cmd/cmd.c | 9 +++++++-- execution/execution.c | 4 +++- signal/signal.c | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/cmd/cmd.c b/cmd/cmd.c index 982962e..fa4dd8a 100644 --- a/cmd/cmd.c +++ b/cmd/cmd.c @@ -6,12 +6,14 @@ /* By: cchauvet void ft_cmddel(void *ptr) { @@ -56,13 +58,16 @@ void ft_cmdwaiter(void *ptr) { if (exit_status == 131) { - ft_printf("Quit (core dumped)\n"); + ft_printf("Quit (core dumped)"); *ft_get_exit_code() = 131; } else *ft_get_exit_code() = 130; + ft_printf("\n"); } else *ft_get_exit_code() = WEXITSTATUS(exit_status); } + signal(SIGINT, ft_ctrlc); + signal(SIGQUIT, ft_quit); } diff --git a/execution/execution.c b/execution/execution.c index 8c05ba4..35ac93f 100644 --- a/execution/execution.c +++ b/execution/execution.c @@ -6,7 +6,7 @@ /* By: cchauvet executable, cmd->args, env); return (1); } + signal(SIGQUIT, SIG_IGN); + signal(SIGINT, SIG_IGN); return (0); } diff --git a/signal/signal.c b/signal/signal.c index b09acd1..cc108a5 100644 --- a/signal/signal.c +++ b/signal/signal.c @@ -6,7 +6,7 @@ /* By: cchauvet