|
|
@ -6,7 +6,7 @@ |
|
|
|
/* By: mea <marvin@42.fr> +#+ +:+ +#+ */ |
|
|
|
/* +#+#+#+#+#+ +#+ */ |
|
|
|
/* Created: 2022/05/03 11:48:16 by narnaud #+# #+# */ |
|
|
|
/* Updated: 2022/05/11 15:29:42 by narnaud@stude ### ########.fr */ |
|
|
|
/* Updated: 2022/05/12 08:43:04 by narnaud ### ########.fr */ |
|
|
|
/* */ |
|
|
|
/* ************************************************************************** */ |
|
|
|
|
|
|
@ -71,7 +71,7 @@ int piper(t_datas *datas, t_command *cmd) |
|
|
|
pipe(pip); |
|
|
|
if (!cmd->fd[1]) |
|
|
|
cmd->fd[1] = pip[1]; |
|
|
|
if (!cmd->fd[0]) |
|
|
|
if (!cmd->next->fd[0]) |
|
|
|
cmd->next->fd[0] = pip[0]; |
|
|
|
} |
|
|
|
pid = caller(datas, cmd); |
|
|
@ -82,11 +82,11 @@ int piper(t_datas *datas, t_command *cmd) |
|
|
|
if (DEBUG) |
|
|
|
printf("%s -ope: %d, pid: %d, fdin: %d, fdout: %d\n", cmd->argv[0], cmd->ope, pid, cmd->fd[0], cmd->fd[1]); |
|
|
|
if (cmd->ope == PIPE) |
|
|
|
pid = piper(datas, cmd->next); |
|
|
|
else |
|
|
|
pid = piper(datas, cmd->next); |
|
|
|
waitpid(pid, &status, 0); |
|
|
|
datas->exit_code = handle_status(datas, status); |
|
|
|
if (cmd->ope != PIPE) |
|
|
|
{ |
|
|
|
waitpid(pid, &status, 0); |
|
|
|
datas->exit_code = handle_status(datas, status); |
|
|
|
while (cmd->next && check_skip(datas, cmd)) |
|
|
|
cmd = cmd->next; |
|
|
|
if (cmd->next) |
|
|
|