Skip to content

Commit

Permalink
fixed, 100%. dont touch my code hugo please(;
Browse files Browse the repository at this point in the history
  • Loading branch information
vctrubio committed Feb 25, 2023
1 parent 10ffff6 commit 6e416c3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
Binary file modified minishell
Binary file not shown.
23 changes: 13 additions & 10 deletions srcs/piping.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ int run_if_first_level_builtins_set_path(t_cmd **curr, char **path,
i[3] = 0;
if (*path)
free(*path);
if (check_if_builtin_not_pipe((*curr))) //PROBLEM HERE PROP
_shell()->exit_code = run_builtin((*curr));
*path = ft_get_exec_path((*curr)->args);
if (*path && access(*path, X_OK) != 0)
{
Expand Down Expand Up @@ -97,15 +95,20 @@ void pipe_commands(t_cmd *cmd)
pipe_commands_build_pipes(pipes, i[2]);
curr = cmd;
i[0] = 0;
while (curr)
if (check_if_builtin_not_pipe(curr)) //PROBLEM HERE PROP
_shell()->exit_code = run_builtin((curr));
else
{
i[1] = i[0] * 2;
if (run_if_first_level_builtins_set_path(&curr, &path, &i[2], &i[0]))
continue ;
pid = fork();
pipe_commands_child_n_error(pid, curr, pipes, path, i);
i[0]++;
curr = curr->next;
while (curr)
{
i[1] = i[0] * 2;
if (run_if_first_level_builtins_set_path(&curr, &path, &i[2], &i[0]))
continue ;
pid = fork();
pipe_commands_child_n_error(pid, curr, pipes, path, i);
i[0]++;
curr = curr->next;
}
}
pipe_commands_cleanup(i[2], pipes, path);
}
Expand Down
Binary file modified srcs/piping.o
Binary file not shown.

0 comments on commit 6e416c3

Please sign in to comment.