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