summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
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; */
}