[FIX] wait all programs to end before prompting
This commit is contained in:
parent
581dad0146
commit
3a85b1a195
2 changed files with 13 additions and 3 deletions
|
@ -6,7 +6,7 @@
|
|||
/* By: mcolonna <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/23 14:15:12 by mcolonna #+# #+# */
|
||||
/* Updated: 2024/04/26 12:33:20 by mcolonna ### ########.fr */
|
||||
/* Updated: 2024/04/26 14:21:43 by mcolonna ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
|||
# include <fcntl.h>
|
||||
# include <stdlib.h>
|
||||
# include <strings.h>
|
||||
# include <sys/wait.h>
|
||||
# include "libft.h"
|
||||
# include "libtf.h"
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jschaft <cecile.schaft@orange.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/24 13:48:00 by jschaft #+# #+# */
|
||||
/* Updated: 2024/04/26 12:31:49 by mcolonna ### ########.fr */
|
||||
/* Updated: 2024/04/26 14:21:15 by mcolonna ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
@ -58,6 +58,15 @@ static int execute_call(t_memclass mc, t_call call, const int inout[2],
|
|||
int execute_command(t_memclass mc, t_command command, char *const envp[])
|
||||
{
|
||||
const int inout[] = {0, 1};
|
||||
int nb_calls;
|
||||
int r;
|
||||
|
||||
return (execute_call(mc, command.calls[0], inout, envp));
|
||||
nb_calls = 1;
|
||||
r = execute_call(mc, command.calls[0], inout, envp);
|
||||
while (nb_calls)
|
||||
{
|
||||
wait(NULL);
|
||||
nb_calls--;
|
||||
}
|
||||
return (r);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue