pipeline.c refactoring
This commit is contained in:
@@ -26,17 +26,21 @@ int pipeline(t_all *c)
|
|||||||
return (0);
|
return (0);
|
||||||
if (!pipeline_find_access(pipeline, c->path))
|
if (!pipeline_find_access(pipeline, c->path))
|
||||||
return (0);
|
return (0);
|
||||||
if (pipeline[0]->builtin_f && ft_2d_arrlen(pipeline) == 1)
|
if (ft_2d_arrlen(pipeline) > 1)
|
||||||
|
wait_subshell(pipeline_exec(pipeline, c));
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if (!pipeline[0]->error)
|
if (pipeline[0]->error)
|
||||||
|
set_last_exit_status(pipeline[0]->error);
|
||||||
|
else if (pipeline[0]->builtin_f)
|
||||||
{
|
{
|
||||||
ret = simple_command_builtin(pipeline[0], c);
|
ret = simple_command_builtin(pipeline[0], c);
|
||||||
if (ret != EXIT_SUCCESS)
|
if (ret != EXIT_SUCCESS)
|
||||||
set_last_exit_status(ret);
|
set_last_exit_status(ret);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
wait_subshell(pipeline_exec(pipeline, c));
|
wait_subshell(pipeline_exec(pipeline, c));
|
||||||
|
}
|
||||||
free_pipeline(&c->pipeline);
|
free_pipeline(&c->pipeline);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user