fix: signal double prompt

This commit is contained in:
Camille Chauvet 2023-04-17 10:41:54 +00:00
parent 882a39fc94
commit 2f6daa4ce5
3 changed files with 11 additions and 4 deletions

View File

@ -6,12 +6,14 @@
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/15 14:18:21 by cchauvet #+# #+# */
/* Updated: 2023/04/07 15:17:21 by alouis-j ### ########.fr */
/* Updated: 2023/04/17 10:41:23 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include "cmd.h"
#include "cmd_private.h"
#include "../signal/signal.h"
#include <signal.h>
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);
}

View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/21 12:45:16 by cchauvet #+# #+# */
/* Updated: 2023/04/14 13:04:01 by cchauvet ### ########.fr */
/* Updated: 2023/04/14 17:17:16 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
@ -58,6 +58,8 @@ static bool ft_executor(t_data *data, t_cmd *cmd, char **env)
execve(cmd->executable, cmd->args, env);
return (1);
}
signal(SIGQUIT, SIG_IGN);
signal(SIGINT, SIG_IGN);
return (0);
}

View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/03/28 15:59:01 by cchauvet #+# #+# */
/* Updated: 2023/04/11 13:02:34 by cchauvet ### ########.fr */
/* Updated: 2023/04/17 10:39:36 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */