fix: execute own builtin

This commit is contained in:
Camille Chauvet 2023-02-28 13:10:02 +01:00
parent 370e5149d5
commit ca18dd4205
3 changed files with 8 additions and 0 deletions

Binary file not shown.

4
cmd.c
View File

@ -22,6 +22,10 @@ void ft_cmddel(void *ptr)
ft_freer_tab_ultimate(1, content->args); ft_freer_tab_ultimate(1, content->args);
if (content->executable != NULL) if (content->executable != NULL)
free(content->executable); free(content->executable);
if (content->fd_in > 2)
close(content->fd_out);
if (content->fd_in > 2)
close(content->fd_out);
free(content); free(content);
} }

View File

@ -153,12 +153,16 @@ int ft_cmds_executor(t_data *data, t_list **cmds)
content->fd_out = fds[1]; content->fd_out = fds[1];
((t_cmd *) current->next->content)->fd_in = fds[0]; ((t_cmd *) current->next->content)->fd_in = fds[0];
} }
exit_code = ft_own_cmd(data, content);
if (exit_code == -1)
{ {
content->executable = ft_get_executable_path(data, content->executable = ft_get_executable_path(data,
content->executable); content->executable);
if (content->executable != NULL) if (content->executable != NULL)
exit_code = ft_executor(data, content); exit_code = ft_executor(data, content);
} }
else if (exit_code == -2)
return (1);
if (ft_gen_exit_code_var(data)) if (ft_gen_exit_code_var(data))
return (1); return (1);
if (content->fd_in > 2) if (content->fd_in > 2)