mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
fix(connec_cmd_execute): do not execute more than one command per process
This commit is contained in:
parent
596b21fc2f
commit
204ed35ff4
1 changed files with 12 additions and 6 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/04/07 10:38:55 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();
|
pid1 = fork();
|
||||||
if (pid1 == 0)
|
if (pid1 == 0)
|
||||||
cmd_execute(cmd->first, app);
|
cmd_execute(cmd->first, app);
|
||||||
pid2 = fork();
|
else
|
||||||
if (pid2 == 0)
|
{
|
||||||
cmd_execute(cmd->second, app);
|
pid2 = fork();
|
||||||
do_waitpid(app, pid1);
|
if (pid2 == 0)
|
||||||
do_waitpid(app, pid2);
|
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)
|
void connec_cmd_execute(t_connec_cmd *cmd, t_minishell *app)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue