From 3065937842bc1b3071d7e1394837ed0c1cf70236 Mon Sep 17 00:00:00 2001 From: yosyo Date: Sat, 6 Jul 2024 18:04:35 +0200 Subject: [PATCH] =?UTF-8?q?=E3=80=8C=F0=9F=94=A8=E3=80=8D=20fix(exec=5Fcmd?= =?UTF-8?q?):=20fixed=20command=20not=20being=20executed=20in=20a=20fork?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/exec/exec_split_cmd.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/exec/exec_split_cmd.c b/src/exec/exec_split_cmd.c index 0bcd055..6fbb775 100644 --- a/src/exec/exec_split_cmd.c +++ b/src/exec/exec_split_cmd.c @@ -6,7 +6,7 @@ /* By: mmoussou cmd) < 5) + if (is_in_builtins(cmd->cmd) && is_in_builtins(cmd->cmd) < 5) { exec_cmd(cmd->cmd, cmd->argv, env, env_t); + return (0); } fork_pid = fork(); if (!fork_pid) @@ -194,7 +195,8 @@ int exec_split_cmd(t_list *list_cmd, t_env *env) i--; if (i < 1) return (0); - waitpid(status, &return_code, 0); + if (status != 0) + waitpid(status, &return_code, 0); while (i - 1) { waitpid(-1, NULL, 0);