close cmd fd after each exec

This commit is contained in:
lperrey
2021-12-20 18:10:53 +01:00
parent 0cfb13595c
commit e138e6550b
3 changed files with 22 additions and 16 deletions

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/16 01:57:38 by lperrey #+# #+# */
/* Updated: 2021/12/16 15:55:36 by lperrey ### ########.fr */
/* Updated: 2021/12/20 18:08:16 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
@@ -97,9 +97,9 @@ static pid_t pipeline_exec(t_cmd *pipeline[], t_all *c)
if (ret != EXIT_SUCCESS)
exit_free(c, ret);
}
close_cmd_fd(pipeline[i]);
i++;
}
close_pipeline_fd(c->pipeline);
i -= 1;
if (pipeline[i]->error)
set_last_exit_status(pipeline[i]->error);