check of cmd->error :
- before calling cmd_find_access() - before calling simple_command_builtin()
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
|
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2021/11/16 01:57:38 by lperrey #+# #+# */
|
/* Created: 2021/11/16 01:57:38 by lperrey #+# #+# */
|
||||||
/* Updated: 2021/12/01 16:49:37 by lperrey ### ########.fr */
|
/* Updated: 2021/12/11 05:24:07 by lperrey ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -18,14 +18,25 @@ static pid_t pipeline_exec(t_cmd *pipeline[], t_all *c);
|
|||||||
|
|
||||||
int pipeline(t_all *c)
|
int pipeline(t_all *c)
|
||||||
{
|
{
|
||||||
if (!open_pipes(c->pipeline))
|
t_cmd **pipeline;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
pipeline = c->pipeline;
|
||||||
|
if (!open_pipes(pipeline))
|
||||||
return (0);
|
return (0);
|
||||||
if (!pipeline_find_access(c->pipeline, c->path))
|
if (!pipeline_find_access(pipeline, c->path))
|
||||||
return (0);
|
return (0);
|
||||||
if (ft_2d_arrlen(c->pipeline) == 1 && c->pipeline[0]->builtin_f)
|
if (pipeline[0]->builtin_f && ft_2d_arrlen(pipeline) == 1)
|
||||||
simple_command_builtin(c->pipeline[0], c);
|
{
|
||||||
|
if (!pipeline[0]->error)
|
||||||
|
{
|
||||||
|
ret = simple_command_builtin(pipeline[0], c);
|
||||||
|
if (ret != EXIT_SUCCESS)
|
||||||
|
set_last_exit_status(ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
wait_subshell(pipeline_exec(c->pipeline, c));
|
wait_subshell(pipeline_exec(pipeline, c));
|
||||||
free_pipeline(&c->pipeline);
|
free_pipeline(&c->pipeline);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
@@ -61,9 +72,12 @@ static int pipeline_find_access(t_cmd *pipeline[], char *path[])
|
|||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (pipeline[i])
|
while (pipeline[i])
|
||||||
|
{
|
||||||
|
if (!pipeline[i]->error)
|
||||||
{
|
{
|
||||||
if (!cmd_find_access(pipeline[i], path))
|
if (!cmd_find_access(pipeline[i], path))
|
||||||
return (0);
|
return (0);
|
||||||
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
return (1);
|
return (1);
|
||||||
|
|||||||
Reference in New Issue
Block a user