summaryrefslogtreecommitdiffstats
path: root/src/e_builtins.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-08-06 20:14:49 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-08-06 20:14:49 +0200
commitf4543e30db89d6d2fef151f63e558cdd6ba7e646 (patch)
treedf3cdab9e26fd112438b4c5dd4e00fec9db6503d /src/e_builtins.c
parentRemoved shit (diff)
download42-minishell-f4543e30db89d6d2fef151f63e558cdd6ba7e646.tar.gz
42-minishell-f4543e30db89d6d2fef151f63e558cdd6ba7e646.tar.bz2
42-minishell-f4543e30db89d6d2fef151f63e558cdd6ba7e646.tar.xz
42-minishell-f4543e30db89d6d2fef151f63e558cdd6ba7e646.tar.zst
42-minishell-f4543e30db89d6d2fef151f63e558cdd6ba7e646.zip
Going back the old way
Diffstat (limited to '')
-rw-r--r--src/e_builtins.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/e_builtins.c b/src/e_builtins.c
index e84094a..c76f438 100644
--- a/src/e_builtins.c
+++ b/src/e_builtins.c
@@ -26,9 +26,22 @@ void
uint8_t bu_id,
t_msh *msh)
{
- int32_t ret;
+ /* int32_t ret; */
+ pid_t pid;
- dup_redirs(ptr, msh);
- ret = msh->bu_ptr[bu_id](ptr->argv + 1, msh);
- msh->ret = ret;
+ if ((pid = fork()) == 0)
+ {
+ e_builtin_child(ptr, bu_id, msh);
+ }
+ else if (pid < 0)
+ {
+ /* TODO: handle fork() failed */
+ }
+ else
+ {
+ e_builtin_parent(pid, ptr, bu_id, msh);
+ }
+ /* dup_redirs(ptr, msh); */
+ /* ret = msh->bu_ptr[bu_id](ptr->argv + 1, msh); */
+ /* msh->ret = ret; */
}