fix output when only 1cmd and is builtin

This commit is contained in:
kinou-p 2022-04-20 12:49:51 +02:00
parent 495a9cf884
commit 97474fff51

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/02/28 17:12:52 by sadjigui #+# #+# */
/* Updated: 2022/04/18 03:09:02 by apommier ### ########.fr */
/* Updated: 2022/04/20 12:46:41 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
@ -33,6 +33,10 @@ int is_builtin(char *cmd)
void call_builtin(t_cmd *cmd)
{
dup2(cmd->current_s_cmd->fd[0], 0);
dup2(cmd->current_s_cmd->fd[1], 1);
close(cmd->current_s_cmd->fd[0]);
close(cmd->current_s_cmd->fd[1]);
if (!ft_strcmp(cmd->current_s_cmd->cmd, "exit"))
ft_exit(cmd->current_s_cmd);
if (!ft_strcmp(cmd->current_s_cmd->cmd, "env"))