diff --git a/src/executing/common/do_waitpid.c b/src/executing/common/do_waitpid.c index ba94c8d..009904d 100644 --- a/src/executing/common/do_waitpid.c +++ b/src/executing/common/do_waitpid.c @@ -6,7 +6,7 @@ /* By: kcolin +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/04/04 19:55:22 by kcolin #+# #+# */ -/* Updated: 2025/04/28 12:29:50 by kcolin ### ########.fr */ +/* Updated: 2025/05/02 12:19:51 by kcolin ### ########.fr */ /* */ /* ************************************************************************** */ @@ -29,9 +29,5 @@ void do_waitpid(t_minishell *app, int pid) if (WIFEXITED(wstatus)) app->last_return_value = WEXITSTATUS(wstatus); if (WIFSIGNALED(wstatus)) - { app->last_return_value = 128 + WTERMSIG(wstatus); - if (WTERMSIG(wstatus) == SIGQUIT) - ft_dprintf(STDERR_FILENO, "Quit (core dumped)"); - } } diff --git a/src/sig/sig.c b/src/sig/sig.c index addf66c..1747ba2 100644 --- a/src/sig/sig.c +++ b/src/sig/sig.c @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* sig.c :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: jguelen +#+ +:+ +#+ */ +/* By: kcolin +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ -/* Created: 2025/02/20 10:26:05 by jguelen #+# #+# */ -/* Updated: 2025/04/17 12:05:07 by kcolin ### ########.fr */ +/* Created: 2025/05/02 12:16:37 by kcolin #+# #+# */ +/* Updated: 2025/05/02 12:18:17 by kcolin ### ########.fr */ /* */ /* ************************************************************************** */ @@ -38,6 +38,7 @@ int set_interactive_mode_sig_handling(void) return (-1); if (sigaction(SIGINT, &sig_act, NULL) == -1) return (-1); + sig_act.sa_handler = SIG_IGN; if (sigaction(SIGQUIT, &sig_act, NULL) == -1) return (-1); return (0); diff --git a/src/sig/sig_handlers.c b/src/sig/sig_handlers.c index a1ab13d..ef63793 100644 --- a/src/sig/sig_handlers.c +++ b/src/sig/sig_handlers.c @@ -6,7 +6,7 @@ /* By: kcolin +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/04/17 12:01:39 by kcolin #+# #+# */ -/* Updated: 2025/05/02 12:03:49 by kcolin ### ########.fr */ +/* Updated: 2025/05/02 12:20:24 by kcolin ### ########.fr */ /* */ /* ************************************************************************** */ @@ -48,6 +48,13 @@ void sig_cmd(int signum, siginfo_t *siginfo, void *context) { (void)context; (void)siginfo; - ft_printf("\n"); + if (signum == SIGQUIT) + { + ft_dprintf(STDERR_FILENO, "Quit (core dumped)\n"); + } + else + { + ft_printf("\n"); + } g_signum = signum; }