summaryrefslogtreecommitdiffstats
path: root/src/ft_e_lcom.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-04-23 14:00:33 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-04-23 14:00:33 +0200
commita94de38d1d4dc2c510388e2ab4e07bfc29b3855d (patch)
treede9dc8897ddaa2caa4424852bf58d29b166548c4 /src/ft_e_lcom.c
parentQwe (diff)
download42-minishell-a94de38d1d4dc2c510388e2ab4e07bfc29b3855d.tar.gz
42-minishell-a94de38d1d4dc2c510388e2ab4e07bfc29b3855d.tar.bz2
42-minishell-a94de38d1d4dc2c510388e2ab4e07bfc29b3855d.tar.xz
42-minishell-a94de38d1d4dc2c510388e2ab4e07bfc29b3855d.tar.zst
42-minishell-a94de38d1d4dc2c510388e2ab4e07bfc29b3855d.zip
WHY YOU EXIT
Diffstat (limited to 'src/ft_e_lcom.c')
-rw-r--r--src/ft_e_lcom.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/ft_e_lcom.c b/src/ft_e_lcom.c
index 3468954..61b9cd7 100644
--- a/src/ft_e_lcom.c
+++ b/src/ft_e_lcom.c
@@ -17,6 +17,8 @@
#include <unistd.h>
#include <signal.h>
#include <sys/wait.h>
+#include "ft_s_destroy.h"
+#include "ft_s_lcom.h"
#include "ft_s_struct.h"
static uint8_t
@@ -41,6 +43,7 @@ uint8_t
t_lcom *ptr;
int32_t fd;
int32_t status;
+ int32_t ret;
uint8_t bu_id;
pid_t pid;
@@ -52,7 +55,6 @@ uint8_t
{
if ((pid = fork()) == 0)
{
- ft_printf("[%hhd] [%s]\n", ptr->redir, ptr->rdrpath);
if (ptr->redir == 1)
{
if ((fd = open(ptr->rdrpath,
@@ -74,7 +76,10 @@ uint8_t
close(fd);
}
msh->ret = msh->bu_ptr[bu_id](ptr->args, msh);
- exit(msh->ret);
+ ret = msh->ret;
+ ft_lcom_clear(&msh->curr);
+ ft_s_destroy(msh);
+ exit(ret);
}
else if (pid < 0)
{