|
|
@ -6,7 +6,7 @@ |
|
|
|
/* By: narnaud <narnaud@student.42.fr> +#+ +:+ +#+ */ |
|
|
|
/* +#+#+#+#+#+ +#+ */ |
|
|
|
/* Created: 2022/05/02 12:14:09 by narnaud #+# #+# */ |
|
|
|
/* Updated: 2022/05/03 15:50:18 by narnaud ### ########.fr */ |
|
|
|
/* Updated: 2022/05/03 16:25:14 by narnaud ### ########.fr */ |
|
|
|
/* */ |
|
|
|
/* ************************************************************************** */ |
|
|
|
|
|
|
@ -21,7 +21,7 @@ int caller(t_command *cmd) |
|
|
|
int status; |
|
|
|
|
|
|
|
|
|
|
|
if (cmd->next && cmd->fd[0] == 0 && cmd->next->fd[1] == 0) |
|
|
|
if (cmd->fd[1] == 0 && cmd->next && cmd->next->fd[0] == 0) |
|
|
|
{ |
|
|
|
pipe(pip); |
|
|
|
cmd->fd[1] = pip[1]; |
|
|
@ -45,7 +45,10 @@ int caller(t_command *cmd) |
|
|
|
close(cmd->fd[1]); |
|
|
|
if (cmd->next) |
|
|
|
return (caller(cmd->next)); |
|
|
|
waitpid(pid, &status, 0); |
|
|
|
waitpid(pid, &status, 0); |
|
|
|
if (cmd->fd[0]) |
|
|
|
close(cmd->fd[0]); |
|
|
|
|
|
|
|
return (cmd_ret); |
|
|
|
} |
|
|
|
|
|
|
|