From f4543e30db89d6d2fef151f63e558cdd6ba7e646 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Thu, 6 Aug 2020 20:14:49 +0200 Subject: Going back the old way --- src/e_builtins.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src/e_builtins.c') 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; */ } -- cgit v1.2.3