diff --git a/src/executing/connec_cmd/connec_cmd_execute.c b/src/executing/connec_cmd/connec_cmd_execute.c index 1ab137e..8248a83 100644 --- a/src/executing/connec_cmd/connec_cmd_execute.c +++ b/src/executing/connec_cmd/connec_cmd_execute.c @@ -6,7 +6,7 @@ /* By: khais +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/04/07 10:38:55 by khais #+# #+# */ -/* Updated: 2025/04/09 16:58:44 by khais ### ########.fr */ +/* Updated: 2025/04/10 15:27:08 by khais ### ########.fr */ /* */ /* ************************************************************************** */ @@ -37,11 +37,17 @@ static void connec_pipe_cmd_execute(t_connec_cmd *cmd, t_minishell *app) pid1 = fork(); if (pid1 == 0) cmd_execute(cmd->first, app); - pid2 = fork(); - if (pid2 == 0) - cmd_execute(cmd->second, app); - do_waitpid(app, pid1); - do_waitpid(app, pid2); + else + { + pid2 = fork(); + if (pid2 == 0) + cmd_execute(cmd->second, app); + else + { + do_waitpid(app, pid1); + do_waitpid(app, pid2); + } + } } void connec_cmd_execute(t_connec_cmd *cmd, t_minishell *app)